private contentAreaToolboxService.TagInfo CreateNewTag(System.Type type) { if (this.tagList == null) { this.tagList = new List <contentAreaToolboxService.TagInfo>(); } TagPrefixAttribute tagprefix = null; TagPrefixAttribute[] tagPrefixes = (TagPrefixAttribute[])type.Assembly.GetCustomAttributes(typeof(TagPrefixAttribute), true); foreach (TagPrefixAttribute tag in tagPrefixes) { if (tag.NamespaceName == type.Namespace) { tagprefix = tag; break; } } contentAreaToolboxService.TagInfo item = null; if (tagprefix != null) { item = new contentAreaToolboxService.TagInfo(tagprefix.TagPrefix, type.Assembly.FullName, type.Namespace); } else { item = new contentAreaToolboxService.TagInfo(string.Format(CultureInfo.InvariantCulture, "CustomTag_{0}", new object[] { this.tagList.Count }), type.Assembly.FullName, type.Namespace); } if (item != null && !tagList.Contains(item)) { this.tagList.Add(item); } return(item); }
public override Type GetChildControlType(String strTagName, IDictionary attributes) { // Get the predefined TagPrefix (if exists) from this Assembly if (tagprefix == null) { System.Reflection.Assembly assembly = System.Reflection.Assembly.GetAssembly(typeof(WeavverTabControl)); object[] tagPrefixes = assembly.GetCustomAttributes(typeof(TagPrefixAttribute), false); if (tagPrefixes.Length > 0) { tagprefix = (TagPrefixAttribute)tagPrefixes[0]; } } Type type = null; // Check to see if the current tag is a Tab. if (tagprefix != null) { if (String.Compare(strTagName, tagprefix.NamespaceName + ":tab", true) == 0 || String.Compare(strTagName, tagprefix.TagPrefix + ":tab", true) == 0) { type = typeof(WeavverTabControlTab); } } return(type); }
public void Deny_Unrestricted() { TagPrefixAttribute tpa = new TagPrefixAttribute("namespace", "prefix"); Assert.AreEqual("namespace", tpa.NamespaceName, "NamespaceName"); Assert.AreEqual("prefix", tpa.TagPrefix, "TagPrefix"); }
string IWebFormReferenceManager.GetTagPrefix(Type objectType) { string prefix = _registerDirectives.GetTagPrefix(objectType); if (prefix == null) { Assembly assembly = objectType.Assembly; object[] locals1 = assembly.GetCustomAttributes(typeof(TagPrefixAttribute), true); string str2 = objectType.Namespace; bool flag = false; object[] locals2 = locals1; for (int i = 0; i < locals2.Length; i++) { TagPrefixAttribute tagPrefixAttribute = (TagPrefixAttribute)locals2[i]; if (str2.Equals(tagPrefixAttribute.NamespaceName)) { prefix = tagPrefixAttribute.TagPrefix; flag = true; } } if (!flag) { int i = _tagPrefixCounter++; prefix = String.Concat("n", i); } string str3; if (assembly.GlobalAssemblyCache) { str3 = assembly.GetName().FullName; } else { str3 = assembly.GetName().Name; } _registerDirectives.AddRegisterDirective(new RegisterDirective(prefix, str2, str3)); } return(prefix); }