internal bool ConfigureObject(ICustomAttributeProvider t, ICatalogObject obj, ICatalogCollection coll, string prefix, Hashtable cache) { bool flag = false; object[] customAttributes = t.GetCustomAttributes(true); cache[prefix] = obj; cache[prefix + "Type"] = t; cache[prefix + "Collection"] = coll; cache["CurrentTarget"] = prefix; foreach (object obj2 in customAttributes) { if (obj2 is IConfigurationAttribute) { try { IConfigurationAttribute attribute = (IConfigurationAttribute)obj2; if (attribute.IsValidTarget(prefix) && attribute.Apply(cache)) { flag = true; } } catch (Exception exception) { if ((exception is NullReferenceException) || (exception is SEHException)) { throw; } throw new RegistrationException(Resource.FormatString("Reg_ComponentAttrErr", obj.Name(), obj2), exception); } } } return(flag); }
private void FixupMethodSecurityForInterface(ICatalogCollection coll, Type InterfaceType) { ICatalogObject obj = null; // Look through the interfaces in ifcColl, and find specific interface. Guid iid = Marshal.GenerateGuidForType(InterfaceType); int count = coll.Count(); for (int i = 0; i < count; i++) { ICatalogObject test = (ICatalogObject)(coll.Item(i)); if (new Guid((String)(test.Key())) == iid) { obj = test; break; } } DBG.Assert(obj != null, "Could not find interface " + InterfaceType + " in catalog!"); if (obj != null) { SecurityRoleAttribute attr = new SecurityRoleAttribute("Marshaler", false); attr.Description = Resource.FormatString("Reg_MarshalerDesc"); IConfigurationAttribute confattr = attr as IConfigurationAttribute; DBG.Assert(confattr != null, "SecurityRoleAttribute does not support IConfigurationAttribute!"); // Now, set up the cache to configure this interface: _cache["CurrentTarget"] = "Interface"; _cache["InterfaceCollection"] = coll; _cache["Interface"] = obj; _cache["InterfaceType"] = InterfaceType; // First step, Ensure that the role is here: if (confattr.Apply(_cache)) { coll.SaveChanges(); } // Now, fix up the real roles: if (confattr.AfterSaveChanges(_cache)) { coll.SaveChanges(); } } }
internal bool AfterSaveChanges(ICustomAttributeProvider t, ICatalogObject obj, ICatalogCollection coll, string prefix, Hashtable cache) { bool flag = false; object[] customAttributes = t.GetCustomAttributes(true); cache[prefix] = obj; cache[prefix + "Type"] = t; cache[prefix + "Collection"] = coll; cache["CurrentTarget"] = prefix; foreach (object obj2 in customAttributes) { if (obj2 is IConfigurationAttribute) { IConfigurationAttribute attribute = (IConfigurationAttribute)obj2; if (attribute.IsValidTarget(prefix) && attribute.AfterSaveChanges(cache)) { flag = true; } } } return(flag); }
private void FixupMethodSecurityForInterface(ICatalogCollection coll, Type InterfaceType) { ICatalogObject obj2 = null; Guid guid = Marshal.GenerateGuidForType(InterfaceType); int num = coll.Count(); for (int i = 0; i < num; i++) { ICatalogObject obj3 = (ICatalogObject)coll.Item(i); if (new Guid((string)obj3.Key()) == guid) { obj2 = obj3; break; } } if (obj2 != null) { SecurityRoleAttribute attribute = new SecurityRoleAttribute("Marshaler", false) { Description = Resource.FormatString("Reg_MarshalerDesc") }; IConfigurationAttribute attribute2 = attribute; this._cache["CurrentTarget"] = "Interface"; this._cache["InterfaceCollection"] = coll; this._cache["Interface"] = obj2; this._cache["InterfaceType"] = InterfaceType; if (attribute2.Apply(this._cache)) { coll.SaveChanges(); } if (attribute2.AfterSaveChanges(this._cache)) { coll.SaveChanges(); } } }