示例#1
0
 protected bool loadPlugin(byte[] rawDll, string fileName)
 {
     try
     {
         var assembly = Assembly.Load(rawDll);
         var types    = assembly.GetTypes();
         foreach (var type in types)
         {
             if (type.GetInterfaces().Length > 0)
             {
                 IGamePlugin instance = assembly.CreateInstance(type.FullName) as IGamePlugin;
                 if (instance != null)
                 {
                     mPluginList.Add(instance.getPluginName(), instance);
                     logInfo("game plugin " + instance.getPluginName() + " load success!");
                 }
             }
         }
     }
     catch (Exception e)
     {
         logInfo("load game plugin failed! file name : " + fileName + ", info : " + e.Message);
         return(false);
     }
     return(true);
 }
示例#2
0
 protected bool loadPlugin(byte[] rawDll)
 {
     try
     {
         var assembly = Assembly.Load(rawDll);
         var types    = assembly.GetTypes();
         foreach (var type in types)
         {
             if (type.GetInterfaces().Length > 0)
             {
                 IGamePlugin instance = assembly.CreateInstance(type.FullName) as IGamePlugin;
                 if (instance != null)
                 {
                     mPluginList.Add(instance.getPluginName(), instance);
                 }
             }
         }
     }
     catch
     {
         return(false);
     }
     return(true);
 }