コード例 #1
0
ファイル: PluginUtils.cs プロジェクト: Tychodewaard/OpenStore
        public static void CreateSystemPlugins()
        {
            var cachekey = "pluginlistsystem";
            var pList    = NBrightBuyUtils.GetCache(cachekey);

            if (pList == null)
            {
                var objCtrl = new NBrightBuyController();
                var rtnList = objCtrl.GetList(99999, -1, "PLUGIN", "", "order by nb1.xmldata.value('(genxml/hidden/index)[1]','float')");
                if (rtnList.Count == 0)
                {
                    var pluginList = new List <NBrightInfo>();
                    var info       = new NBrightInfo();
                    // no menuplugin.xml exists, so must be new install, get new config
                    var pluginfoldermappath = System.Web.Hosting.HostingEnvironment.MapPath(StoreSettings.NBrightBuyPath() + "/Plugins");
                    if (pluginfoldermappath != null && Directory.Exists(pluginfoldermappath) && File.Exists(pluginfoldermappath + "\\menu.config"))
                    {
                        var menuconfig = Utils.ReadFile(pluginfoldermappath + "\\menu.config");
                        if (menuconfig != "")
                        {
                            info.XMLData  = menuconfig;
                            info.PortalId = 99999;
                            pluginList    = CalcSystemPluginList(info);
                            CreateDBrecords(pluginList, 99999);
                            CreatePortalPlugins();
                        }
                    }
                }
                NBrightBuyUtils.SetCache(cachekey, "True");
            }
        }
コード例 #2
0
ファイル: PluginData.cs プロジェクト: wenyumou/OpenStore
 public PluginData(int portalId, bool usecache = true)
 {
     _cachekey = "pluginlist" + portalId;
     if (usecache)
     {
         var pList = NBrightBuyUtils.GetCache(_cachekey);
         if (pList != null)
         {
             _pluginList = (List <NBrightInfo>)pList;
         }
         // if we have zero plugins, try and reload
         if (pList == null || !_pluginList.Any())
         {
             _pluginList = PluginUtils.GetPluginList(portalId);
             NBrightBuyUtils.SetCache(_cachekey, _pluginList);
         }
     }
     else
     {
         _pluginList = PluginUtils.GetPluginList(portalId);
     }
 }