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

            if (string.IsNullOrEmpty(name))
            {
                result = null;
            }
            else
            {
                Type plugin = SMSPlugins.Instance().GetPlugin("SMSSender", name);
                if (plugin == null)
                {
                    result = null;
                }
                else
                {
                    SMSSender sMSSender = Activator.CreateInstance(plugin) as SMSSender;
                    if (sMSSender != null && !string.IsNullOrEmpty(configXml))
                    {
                        XmlDocument xmlDocument = new XmlDocument();
                        xmlDocument.LoadXml(configXml);
                        sMSSender.InitConfig(xmlDocument.FirstChild);
                    }
                    result = sMSSender;
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
 private static void ProcessSMSSender(HttpContext context)
 {
     if (context.Request["action"] == "getlist")
     {
         SMSPlugins sMSPlugins = SMSPlugins.Instance();
         context.Response.ContentType = "application/json";
         context.Response.Write(sMSPlugins.GetPlugins().ToJsonString());
     }
     else
     {
         if (context.Request["action"] == "getmetadata")
         {
             context.Response.ContentType = "text/xml";
             SMSSender sMSSender = SMSSender.CreateInstance(context.Request["name"]);
             if (sMSSender == null)
             {
                 context.Response.Write("<xml></xml>");
             }
             else
             {
                 context.Response.Write(sMSSender.GetMetaData().OuterXml);
             }
         }
     }
 }