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); }
public static SMSPlugins Instance() { if (SMSPlugins.instance == null) { lock (SMSPlugins.LockHelper) { if (SMSPlugins.instance == null) { SMSPlugins.instance = new SMSPlugins(); } } } SMSPlugins.instance.VerifyIndex(); return(SMSPlugins.instance); }
public static SMSPlugins Instance() { if (instance == null) { lock (LockHelper) { if (instance == null) { instance = new SMSPlugins(); } } } instance.VerifyIndex(); return instance; }
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); } }
public static SMSPlugins Instance() { if (SMSPlugins.instance == null) { object lockHelper; Monitor.Enter(lockHelper = SMSPlugins.LockHelper); try { if (SMSPlugins.instance == null) { SMSPlugins.instance = new SMSPlugins(); } } finally { Monitor.Exit(lockHelper); } } SMSPlugins.instance.VerifyIndex(); return(SMSPlugins.instance); }
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); }
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); }
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); } } }