Exemple #1
0
 private static void ProcessXinGeSender(HttpContext context)
 {
     if (context.Request["action"] == "getlist")
     {
         XingePushPlugins xinGePlugins = XingePushPlugins.Instance();
         context.Response.ContentType = "application/json";
         context.Response.Write(xinGePlugins.GetPlugins().ToJsonString());
     }
     else
     {
         if (context.Request["action"] == "getmetadata")
         {
             context.Response.ContentType = "text/xml";
             XingePush xinGePlugins = XingePush.CreateInstance(context.Request["name"]);
             if (xinGePlugins == null)
             {
                 context.Response.Write("<xml></xml>");
             }
             else
             {
                 context.Response.Write(xinGePlugins.GetMetaData().OuterXml);
             }
         }
     }
 }
Exemple #2
0
        public static XingePush CreateInstance(string name, string configXml)
        {
            XingePush result;

            if (string.IsNullOrEmpty(name))
            {
                result = null;
            }
            else
            {
                Type plugin = XingePushPlugins.Instance().GetPlugin("XingePush", name);
                if (plugin == null)
                {
                    result = null;
                }
                else
                {
                    XingePush xingePush = Activator.CreateInstance(plugin) as XingePush;
                    if (xingePush != null && !string.IsNullOrEmpty(configXml))
                    {
                        XmlDocument xmlDocument = new XmlDocument();
                        xmlDocument.LoadXml(configXml);
                        xingePush.InitConfig(xmlDocument.FirstChild);
                    }
                    result = xingePush;
                }
            }
            return(result);
        }
 public static XingePushPlugins Instance()
 {
     if (XingePushPlugins.instance == null)
     {
         object lockHelper;
         Monitor.Enter(lockHelper = XingePushPlugins.LockHelper);
         try
         {
             if (XingePushPlugins.instance == null)
             {
                 XingePushPlugins.instance = new XingePushPlugins();
             }
         }
         finally
         {
             Monitor.Exit(lockHelper);
         }
     }
     XingePushPlugins.instance.VerifyIndex();
     return(XingePushPlugins.instance);
 }