示例#1
0
            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);
            }
示例#2
0
 public contentAreaToolboxService.TagInfo GetTag(System.Type type)
 {
     contentAreaToolboxService.TagInfo info = FindTag(type, builtInTags);
     if (info == null)
     {
         info = FindTag(type, this.tagList);
     }
     if (info == null)
     {
         return(this.CreateNewTag(type));
     }
     return(info);
 }