Ejemplo n.º 1
0
        public override void Init()
        {
            try
            {
                object[] extensions = new HttpApplicationExtensionPoint().CreateExtensions();

                foreach (IHttpApplicationExtension ext in extensions)
                {
                    if (AttributeUtils.HasAttribute<ImageServerModuleAttribute>(ext.GetType(), true))
                    {
                        string methodName = AttributeUtils.GetAttribute<ImageServerModuleAttribute>(ext.GetType()).RegisterMethod;
                        if (String.IsNullOrEmpty(methodName))
                        {
                            Platform.Log(LogLevel.Warn, "ImageServerModuleAttribute RegisterMethod is missing in {0}", ext.GetType().FullName);
                        }
                        else
                        {
                            System.Reflection.MethodInfo method = ext.GetType().GetMethod(methodName, BindingFlags.Public | BindingFlags.Static);
                            if (method != null)
                            {
                                method.Invoke(null, new[] { this });
                            }
                        }
                    }
                    else
                    {
                        Platform.Log(LogLevel.Warn, "{0} must be decorated with ImageServerModuleAttribute", ext.GetType().FullName);
                    }
                    
                }
            }
            catch (Exception ex)
            {
                Platform.Log(LogLevel.Warn, ex);
            }

            
            base.Init();
        }
        public override void Init()
        {
            try
            {
                object[] extensions = new HttpApplicationExtensionPoint().CreateExtensions();

                foreach (IHttpApplicationExtension ext in extensions)
                {
                    if (AttributeUtils.HasAttribute <ImageServerModuleAttribute>(ext.GetType(), true))
                    {
                        string methodName = AttributeUtils.GetAttribute <ImageServerModuleAttribute>(ext.GetType()).RegisterMethod;
                        if (String.IsNullOrEmpty(methodName))
                        {
                            Platform.Log(LogLevel.Warn, "ImageServerModuleAttribute RegisterMethod is missing in {0}", ext.GetType().FullName);
                        }
                        else
                        {
                            System.Reflection.MethodInfo method = ext.GetType().GetMethod(methodName, BindingFlags.Public | BindingFlags.Static);
                            if (method != null)
                            {
                                method.Invoke(null, new[] { this });
                            }
                        }
                    }
                    else
                    {
                        Platform.Log(LogLevel.Warn, "{0} must be decorated with ImageServerModuleAttribute", ext.GetType().FullName);
                    }
                }
            }
            catch (Exception ex)
            {
                Platform.Log(LogLevel.Warn, ex);
            }


            base.Init();
        }