private void Initialize(TransformerTypeCollection existingTransformerTypes, ICollection transformerTypes)
 {
     if (existingTransformerTypes != null)
     {
         foreach (Type type in existingTransformerTypes)
         {
             base.InnerList.Add(type);
         }
     }
     if (transformerTypes != null)
     {
         foreach (object obj2 in transformerTypes)
         {
             if (obj2 == null)
             {
                 throw new ArgumentException(System.Web.SR.GetString("Collection_CantAddNull"), "transformerTypes");
             }
             if (!(obj2 is Type))
             {
                 throw new ArgumentException(System.Web.SR.GetString("Collection_InvalidType", new object[] { "Type" }), "transformerTypes");
             }
             if (!((Type) obj2).IsSubclassOf(typeof(WebPartTransformer)))
             {
                 throw new ArgumentException(System.Web.SR.GetString("WebPartTransformerAttribute_NotTransformer", new object[] { ((Type) obj2).Name }), "transformerTypes");
             }
             base.InnerList.Add(obj2);
         }
     }
 }
コード例 #2
0
        private void Initialize(TransformerTypeCollection existingTransformerTypes, ICollection transformerTypes) {
            if (existingTransformerTypes != null) {
                foreach (Type existingTransformerType in existingTransformerTypes) {
                    // Don't need to check arg, since we know it is valid since it came
                    // from a TransformerTypeCollection.
                    InnerList.Add(existingTransformerType);
                }
            }

            if (transformerTypes != null) {
                foreach (object obj in transformerTypes) {
                    if (obj == null) {
                        throw new ArgumentException(SR.GetString(SR.Collection_CantAddNull), "transformerTypes");
                    }
                    if (!(obj is Type)) {
                        throw new ArgumentException(SR.GetString(SR.Collection_InvalidType, "Type"), "transformerTypes");
                    }
                    if (!((Type)obj).IsSubclassOf(typeof(WebPartTransformer))) {
                        throw new ArgumentException(SR.GetString(SR.WebPartTransformerAttribute_NotTransformer, ((Type)obj).Name),
                                                    "transformerTypes");
                    }
                    InnerList.Add(obj);
                }
            }
        }
コード例 #3
0
        private void Initialize(TransformerTypeCollection existingTransformerTypes, ICollection transformerTypes)
        {
            if (existingTransformerTypes != null)
            {
                foreach (Type existingTransformerType in existingTransformerTypes)
                {
                    // Don't need to check arg, since we know it is valid since it came
                    // from a TransformerTypeCollection.
                    InnerList.Add(existingTransformerType);
                }
            }

            if (transformerTypes != null)
            {
                foreach (object obj in transformerTypes)
                {
                    if (obj == null)
                    {
                        throw new ArgumentException(SR.GetString(SR.Collection_CantAddNull), "transformerTypes");
                    }
                    if (!(obj is Type))
                    {
                        throw new ArgumentException(SR.GetString(SR.Collection_InvalidType, "Type"), "transformerTypes");
                    }
                    if (!((Type)obj).IsSubclassOf(typeof(WebPartTransformer)))
                    {
                        throw new ArgumentException(SR.GetString(SR.WebPartTransformerAttribute_NotTransformer, ((Type)obj).Name),
                                                    "transformerTypes");
                    }
                    InnerList.Add(obj);
                }
            }
        }
コード例 #4
0
 private void Initialize(TransformerTypeCollection existingTransformerTypes, ICollection transformerTypes)
 {
     if (existingTransformerTypes != null)
     {
         foreach (Type type in existingTransformerTypes)
         {
             base.InnerList.Add(type);
         }
     }
     if (transformerTypes != null)
     {
         foreach (object obj2 in transformerTypes)
         {
             if (obj2 == null)
             {
                 throw new ArgumentException(System.Web.SR.GetString("Collection_CantAddNull"), "transformerTypes");
             }
             if (!(obj2 is Type))
             {
                 throw new ArgumentException(System.Web.SR.GetString("Collection_InvalidType", new object[] { "Type" }), "transformerTypes");
             }
             if (!((Type)obj2).IsSubclassOf(typeof(WebPartTransformer)))
             {
                 throw new ArgumentException(System.Web.SR.GetString("WebPartTransformerAttribute_NotTransformer", new object[] { ((Type)obj2).Name }), "transformerTypes");
             }
             base.InnerList.Add(obj2);
         }
     }
 }
コード例 #5
0
 protected virtual TransformerTypeCollection CreateAvailableTransformers()
 {
     TransformerTypeCollection types = new TransformerTypeCollection();
     foreach (Type type in RuntimeConfig.GetConfig().WebParts.Transformers.GetTransformerEntries().Values)
     {
         types.Add(type);
     }
     return types;
 }
コード例 #6
0
 public TransformerTypeCollection(TransformerTypeCollection existingTransformerTypes, ICollection transformerTypes) {
     Initialize(existingTransformerTypes, transformerTypes);
 }
コード例 #7
0
        protected virtual TransformerTypeCollection CreateAvailableTransformers() {
            TransformerTypeCollection availableTransformers = new TransformerTypeCollection();

            WebPartsSection configSection = RuntimeConfig.GetConfig().WebParts;

            IDictionary transformers = configSection.Transformers.GetTransformerEntries();

            foreach (Type type in transformers.Values) {
                availableTransformers.Add(type);
            }

            return availableTransformers;
        }
コード例 #8
0
 public TransformerTypeCollection(TransformerTypeCollection existingTransformerTypes, ICollection transformerTypes)
 {
     Initialize(existingTransformerTypes, transformerTypes);
 }