public static NameValueCollection GenerateAttributesCollection(string[] attributes) { NameValueCollection attributeCollection = new NameValueCollection(attributes.Length); foreach (string attribute in attributes) { string key; string value; KeyValuePairParser.DecodeKeyValuePair(attribute, out key, out value); attributeCollection.Add(key, value); } return(attributeCollection); }
/// <summary> /// Overrides the <paramref name="configurationObject"/>'s properties with the Group Policy values from the /// registry. /// </summary> /// <param name="configurationObject">The configuration object for instances that must be managed.</param> /// <param name="policyKey">The <see cref="IRegistryKey"/> which holds the Group Policy overrides for the /// configuration element.</param> /// <remarks>Subclasses that manage custom provider's configuration objects with additional properties may /// override this method to override these properties.</remarks> protected override void OverrideWithGroupPolicies(T configurationObject, IRegistryKey policyKey) { Type providerTypeOverride = policyKey.GetTypeValue(ProviderTypePropertyName); String attributesOverride = policyKey.GetStringValue(AttributesPropertyName); configurationObject.Type = providerTypeOverride; configurationObject.Attributes.Clear(); Dictionary <String, String> attributesDictionary = new Dictionary <string, string>(); KeyValuePairParser.ExtractKeyValueEntries(attributesOverride, attributesDictionary); foreach (KeyValuePair <String, String> kvp in attributesDictionary) { configurationObject.Attributes.Add(kvp.Key, kvp.Value); } }