Esempio n. 1
0
        public void LoadAttribute(string plugfile)
        {
            if (dllList.Count > 0)
            {
                switch (appType)
                {
                case AppType.Web:
                    EntityManager.LoadAttribute(dllList, cache, plugin.name);
                    WebControllerManager.LoadAttribute(dllList, this);
                    WebServicesManager.LoadAttribute(dllList, cache, plugin.name);
                    break;

                case AppType.Winform:
                    //case AppType.WCFClient:
                    EntityManager.LoadAttribute(dllList, cache, plugin.name);
                    WinformControllerManager.LoadAttribute(dllList, this);
                    break;

                case AppType.WCF:
                    EntityManager.LoadAttribute(dllList, cache, plugin.name);
                    WcfControllerManager.LoadAttribute(dllList, this);
                    break;
                }
            }
        }
Esempio n. 2
0
        public static void RemovePlugin(string plugname)
        {
            if (PluginDic.ContainsKey(plugname) == true)
            {
                ICacheManager _cache = PluginDic[plugname].cache;

                switch (AppGlobal.appType)
                {
                case AppType.Web:
                    EntityManager.ClearAttributeData(_cache, plugname);
                    WebControllerManager.ClearAttributeData(_cache, plugname);
                    WebServicesManager.ClearAttributeData(_cache, plugname);
                    break;

                case AppType.Winform:
                    EntityManager.ClearAttributeData(_cache, plugname);
                    WinformControllerManager.ClearAttributeData(_cache, plugname);
                    break;

                case AppType.WCF:
                    EntityManager.ClearAttributeData(_cache, plugname);
                    WcfControllerManager.ClearAttributeData(_cache, plugname);
                    break;
                }

                PluginDic.Remove(plugname);
            }
        }
Esempio n. 3
0
        public HUD(ITSGame game)
        {
            this.game = game;
            lanIp     = WebControllerManager.getLanIpWithPort();

            Title          = new Sprite("Images/title.png", 500, Color.White, false);
            distanceMarker = new Image("Images/distanceIndicator-marker.png");
        }
Esempio n. 4
0
        public override void Dispose()
        {
            connected.Remove(this.index);

            if (connected.Count() == 0)
            {
                manager.Dispose();
                manager = null;
            }
        }
Esempio n. 5
0
        public WebController(int index)
        {
            if (manager == null)
            {
                manager   = new WebControllerManager();
                connected = new HashSet <int>();
            }

            this.index = index;
            connected.Add(this.index);
        }
        public void LoadAttribute(string plugfile)
        {
            string          dllpath = new System.IO.FileInfo(plugfile).DirectoryName + "\\dll";
            List <Assembly> dllList = new List <Assembly>();

            foreach (businessinfoDll dll in plugin.businessinfoDllList)
            {
                //方式一:直接读取文件,这种方式不支持热插拔
                dllList.Add(Assembly.LoadFrom(dllpath + "\\" + dll.name));
                //方式二:把dll读到内存再加载,再次加载内存会不断变大
                //FileStream fs = new FileStream(dllpath + "\\" + dll.name, FileMode.Open, FileAccess.Read);
                //BinaryReader br = new BinaryReader(fs);
                //byte[] bFile = br.ReadBytes((int)fs.Length);
                //br.Close();
                //fs.Close();
                //dllList.Add(Assembly.Load(bFile));
            }
            if (dllList.Count > 0)
            {
                switch (appType)
                {
                case AppType.Web:
                    EntityManager.LoadAttribute(dllList, cache, plugin.name);
                    WebControllerManager.LoadAttribute(dllList, this);
                    WebServicesManager.LoadAttribute(dllList, cache, plugin.name);
                    break;

                case AppType.Winform:
                case AppType.WCFClient:
                    EntityManager.LoadAttribute(dllList, cache, plugin.name);
                    WinformControllerManager.LoadAttribute(dllList, this);
                    break;

                case AppType.WCF:
                    EntityManager.LoadAttribute(dllList, cache, plugin.name);
                    WcfControllerManager.LoadAttribute(dllList, this);
                    break;
                }
            }
        }
Esempio n. 7
0
        public void Remove()
        {
            ICacheManager _cache = cache;

            switch (AppGlobal.appType)
            {
            case AppType.Web:
                EntityManager.ClearAttributeData(_cache, plugin.name);
                WebControllerManager.ClearAttributeData(_cache, plugin.name);
                WebServicesManager.ClearAttributeData(_cache, plugin.name);
                break;

            case AppType.Winform:
                //case AppType.WCFClient:
                EntityManager.ClearAttributeData(_cache, plugin.name);
                WinformControllerManager.ClearAttributeData(_cache, plugin.name);
                break;

            case AppType.WCF:
                EntityManager.ClearAttributeData(_cache, plugin.name);
                WcfControllerManager.ClearAttributeData(_cache, plugin.name);
                break;
            }
        }
 public static WebControllerAttributeInfo GetPluginWebControllerAttributeInfo(string pluginname, string name, out ModulePlugin mp)
 {
     mp = PluginDic[pluginname];
     if (mp != null)
     {
         List <WebControllerAttributeInfo> list = (List <WebControllerAttributeInfo>)WebControllerManager.GetAttributeInfo(mp.cache, mp.plugin.name);
         if (list.FindIndex(x => x.controllerName == name) > -1)
         {
             return(list.Find(x => x.controllerName == name));
         }
     }
     return(null);
 }
Esempio n. 9
0
        public static void AddPlugin(string plugfile)
        {
            if (PluginDic == null)
            {
                PluginDic = new Dictionary <string, ModulePlugin>();
            }

            ModulePlugin mp = new ModulePlugin();

            mp.LoadPlugin(plugfile);

            if (PluginDic.ContainsKey(mp.plugin.name) == false)
            {
                PluginDic.Add(mp.plugin.name, mp);
                List <string> dllList = new List <string>();
                switch (AppGlobal.appType)
                {
                case AppType.Web:
                    foreach (businessinfoDll dll in mp.plugin.businessinfoDllList)
                    {
                        dllList.Add(AppGlobal.AppRootPath + "bin\\" + dll.name);
                    }
                    if (dllList.Count > 0)
                    {
                        EntityManager.LoadAttribute(dllList, mp.cache, mp.plugin.name);
                        WebControllerManager.LoadAttribute(dllList, mp);
                        WebServicesManager.LoadAttribute(dllList, mp.cache, mp.plugin.name);
                    }
                    break;

                case AppType.Winform:
                    foreach (businessinfoDll dll in mp.plugin.businessinfoDllList)
                    {
                        dllList.Add(AppGlobal.AppRootPath + dll.name);
                    }
                    if (dllList.Count > 0)
                    {
                        EntityManager.LoadAttribute(dllList, mp.cache, mp.plugin.name);
                        WinformControllerManager.LoadAttribute(dllList, mp);
                    }
                    break;

                case AppType.WCF:
                    foreach (businessinfoDll dll in mp.plugin.businessinfoDllList)
                    {
                        dllList.Add(AppGlobal.AppRootPath + dll.name);
                    }
                    if (dllList.Count > 0)
                    {
                        EntityManager.LoadAttribute(dllList, mp.cache, mp.plugin.name);
                        WcfControllerManager.LoadAttribute(dllList, mp);
                    }
                    break;

                case AppType.WCFClient:
                    foreach (businessinfoDll dll in mp.plugin.businessinfoDllList)
                    {
                        dllList.Add(AppGlobal.AppRootPath + dll.name);
                    }
                    if (dllList.Count > 0)
                    {
                        WinformControllerManager.LoadAttribute(dllList, mp);
                    }
                    break;
                }
            }
        }