示例#1
0
        private void RegisterHelloWorldHelperClass()
        {
            // TODO ANGEL: Gualtrapa. Borrame!!!!!!!!
            Assembly assembly = Assembly.LoadFile(new System.IO.FileInfo("Samples.dll").FullName);

            /* TODO. Buscar una solucion a esto de cargar la dll
             * Assembly assembly = Assembly.GetEntryAssembly();
             * AssemblyName[] names = assembly.GetReferencedAssemblies();
             */

            if (log.IsDebugEnabled)
            {
                log.Debug("Assembly Name :" + assembly.FullName);
            }

            try
            {
                Type[] Types = assembly.GetTypes();
                // Display all the types contained in the specified assembly.
                foreach (Type oType in Types)
                {
                    HLAinteractionHelperAttribute interactionClass =
                        (HLAinteractionHelperAttribute)System.Attribute.GetCustomAttribute(oType, typeof(HLAinteractionHelperAttribute));

                    if (interactionClass != null)
                    {
                        //Get the Key value.
                        if (log.IsDebugEnabled)
                        {
                            log.Debug("HLAinteractionHelperAttribute Found! in " + oType.FullName +
                                      ". InteractionClass Name: " + interactionClass.Name +
                                      ", Semantics :" + interactionClass.Semantics);
                        }
                        try
                        {
                            FOMTypes[interactionClass.FomName] = oType;
                        }
                        catch (Exception e)
                        {
                            if (log.IsWarnEnabled)
                            {
                                log.Warn("Error creating " + oType.FullName + ": " + e);
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Can't Create Instance: " + e.Message);
                }
            }
        }
示例#2
0
        public void RegisterAssemblyHelpers(Assembly assembly)
        {
            //Assembly assembly = Assembly.GetExecutingAssembly();
            if (log.IsDebugEnabled)
            {
                log.Debug("Assembly Name :" + assembly.FullName);
            }

            try
            {
                Type[] Types = assembly.GetTypes();
                // Display all the types contained in the specified assembly.
                foreach (Type oType in Types)
                {
                    HLAinteractionHelperAttribute interactionClass =
                        (HLAinteractionHelperAttribute)System.Attribute.GetCustomAttribute(oType, typeof(HLAinteractionHelperAttribute));

                    if (interactionClass != null)
                    {
                        //Get the Key value.
                        if (log.IsDebugEnabled)
                        {
                            log.Debug("HLAinteractionHelperAttribute Found! in " + oType.FullName +
                                      ". InteractionClass Name: " + interactionClass.Name +
                                      ", Semantics :" + interactionClass.Semantics);
                        }
                        try
                        {
                            FOMTypes[interactionClass.FomName] = oType;
                        }
                        catch (Exception e)
                        {
                            if (log.IsWarnEnabled)
                            {
                                log.Warn("Error creating " + oType.FullName + ": " + e);
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                if (log.IsErrorEnabled)
                {
                    log.Error("Can't Create Instance: " + e.Message);
                }
            }
        }