Esempio 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);
        }
Esempio 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());
         return;
     }
     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>");
             return;
         }
         context.Response.Write(sMSSender.GetMetaData().OuterXml);
     }
 }
Esempio n. 3
0
        public static SMSSender CreateInstance(string name, string configXml)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(null);
            }
            Type plugin = SMSPlugins.Instance().GetPlugin("SMSSender", name);

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

            if ((sender != null) && !string.IsNullOrEmpty(configXml))
            {
                XmlDocument document = new XmlDocument();
                document.LoadXml(configXml);
                sender.InitConfig(document.FirstChild);
            }
            return(sender);
        }
Esempio n. 4
0
        public static SMSSender CreateInstance(string name, string configXml)
        {
            if (string.IsNullOrEmpty(name))
            {
                return(null);
            }
            Type plugin = SMSPlugins.Instance().GetPlugin("SMSSender", name);

            if (plugin == null)
            {
                return(null);
            }
            SMSSender sMSSender = Activator.CreateInstance(plugin) as SMSSender;

            if (sMSSender != null && !string.IsNullOrEmpty(configXml))
            {
                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.XmlResolver = null;
                xmlDocument.LoadXml(configXml);
                sMSSender.InitConfig(xmlDocument.FirstChild);
            }
            Globals.AppendLog(new Dictionary <string, string>(), "SMSSender CreateInstance" + "--" + name + ":" + configXml, "", "", "/log/SMSSender.txt");
            return(sMSSender);
        }
Esempio n. 5
0
        private static void ProcessSMSSender(HttpContext context)
        {
            IDictionary <string, string> dictionary = Globals.NameValueCollectionToDictionary(context.Request.Form);

            Globals.AppendLog(dictionary, "ProcessSMSSender action:" + context.Request["action"], "", "", "/log/ConfigHandler.txt");
            if (context.Request["action"] == "getlist")
            {
                try
                {
                    SMSPlugins sMSPlugins = SMSPlugins.Instance();
                    context.Response.ContentType = "application/json";
                    Globals.AppendLog(dictionary, "ProcessSMSSender getlist:" + sMSPlugins.GetPlugins().ToJsonString(), "", "", "/log/ConfigHandler.txt");
                    context.Response.Write(sMSPlugins.GetPlugins().ToJsonString());
                }
                catch (Exception e)
                {
                    Globals.AppendLog(dictionary, "ProcessSMSSender getlist error:" + e.Message + "----" + e.StackTrace, "", "", "/log/ConfigHandler.txt");
                    //context.Response.Write(sMSPlugins.GetPlugins().ToJsonString());
                }
            }
            else if (context.Request["action"] == "getmetadata")
            {
                context.Response.ContentType = "text/xml";
                SMSSender sMSSender = SMSSender.CreateInstance(context.Request["name"]);
                Globals.AppendLog(dictionary, "ProcessSMSSender getmetadata name:" + context.Request["name"], "", "", "/log/ConfigHandler.txt");
                if (sMSSender == null)
                {
                    context.Response.Write("<xml></xml>");
                }
                else
                {
                    Globals.AppendLog(dictionary, "ProcessSMSSender getmetadata:" + sMSSender.GetMetaData().OuterXml.ToString(), "", "", "/log/ConfigHandler.txt");
                    context.Response.Write(sMSSender.GetMetaData().OuterXml);
                }
            }
        }
Esempio n. 6
0
 public static SMSSender CreateInstance(string name)
 {
     return(SMSSender.CreateInstance(name, null));
 }