Ejemplo n.º 1
0
        public static EmailSender CreateInstance(string name, string configXml)
        {
            EmailSender result;

            if (string.IsNullOrEmpty(name))
            {
                result = null;
            }
            else
            {
                Type plugin = EmailPlugins.Instance().GetPlugin("EmailSender", name);
                if (plugin == null)
                {
                    result = null;
                }
                else
                {
                    EmailSender emailSender = Activator.CreateInstance(plugin) as EmailSender;
                    if (emailSender != null && !string.IsNullOrEmpty(configXml))
                    {
                        XmlDocument xmlDocument = new XmlDocument();
                        xmlDocument.LoadXml(configXml);
                        emailSender.InitConfig(xmlDocument.FirstChild);
                    }
                    result = emailSender;
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
        public static EmailSender CreateInstance(string name, string configXml)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(null);
            }
            Type plugin = EmailPlugins.Instance().GetPlugin("EmailSender", name);

            if (plugin == null)
            {
                return(null);
            }
            EmailSender sender = Activator.CreateInstance(plugin) as EmailSender;

            if ((sender != null) && !string.IsNullOrEmpty(configXml))
            {
                XmlDocument document = new XmlDocument();
                document.LoadXml(configXml);
                sender.InitConfig(document.FirstChild);
            }
            return(sender);
        }