/// <summary> /// Load SRP record type "Hash" from registryc /// </summary> /// <param name="key"> /// Current Registry Key /// </param> /// <param name="subKey"> /// Requested Registry SubKey /// </param> /// <returns> /// Data from registry /// </returns> private AwlRuleType ProceedSrpHashValue(RegistryKey key, string subKey) { AwlRuleType result = new AwlRuleType(); try { using (RegistryKey registryKey = key.OpenSubKey(subKey)) { if (registryKey != null) { result.Value = registryFunctions.GetRegKeyValueObject(registryKey, "FriendlyName", RegistryValueKind.String); result.Value2 = registryFunctions.GetRegKeyValueObject(registryKey, "SaferFlags", RegistryValueKind.DWord); result.Description = registryFunctions.GetRegKeyValueObject(registryKey, "Description", RegistryValueKind.String); DateTime lastModified = new DateTime(registryFunctions.GetRegKeyValueObjectAsInt(registryKey, "LastModified", RegistryValueKind.QWord)).ToLocalTime().AddYears(1600); result.LastModified = lastModified; } } } catch (NullReferenceException) { } catch (SecurityException) { } return(result); }
private void FilterGridView(IEnumerable itemsControls, string filterText) { ICollectionView cv = CollectionViewSource.GetDefaultView(itemsControls); cv.Filter = o => { AwlRuleType p = o as AwlRuleType; if (String.IsNullOrEmpty(filterText)) { return(true); } else { return(ClassFunctions.IsTextMatchInValues(p, filterText, true)); } }; }
private void ProceedSrpSubValues(RegistryKey key, ObservableCollection <AwlRuleType> rules, string awlType, string subType, string subSubType, string scope) { foreach (string subKey in key.GetSubKeyNames()) { switch (subType) { case "Paths": { AwlRuleType item = ProceedSrpPathsValue(key, subKey); if (!String.IsNullOrEmpty(item.Value)) { item.AwlType = awlType; item.SubType = "Path"; item.SubSubType = subSubType; item.Scope = scope; rules.Add(item); } break; } case "Hashes": { AwlRuleType item = ProceedSrpHashValue(key, subKey); if (!String.IsNullOrEmpty(item.Value)) { item.AwlType = awlType; item.SubType = "Hash"; item.SubSubType = subSubType; item.Scope = scope; rules.Add(item); } break; } default: { throw new NotImplementedException(); } } } }