Пример #1
0
 public void RunModuleCache()
 {
     try
     {
         int count = ModuleHandler.InvokeGetModuleAddonCount();
         int i     = 0;
         for (; i < count; i++)
         {
             object[] obj_temp  = ModuleHandler.InvokeGetModuleAddon(i, true);
             string   key       = (string)obj_temp[0];
             string[] split_key = key.Split(new char[1] {
                 '_'
             }, StringSplitOptions.RemoveEmptyEntries);
             if (split_key[0] == _ptype.ToString())
             {
                 obj_temp = ModuleHandler.InvokeGetModuleAddon(i, false);
                 key      = (string)obj_temp[0];
                 ModuleAddonCallback mac = (ModuleAddonCallback)obj_temp[1];
                 if (ModuleAddons.ContainsKey(key))
                 {
                     ModuleAddons.Remove(key);
                 }
                 ModuleAddons.Add(key, mac);
             }
             else
             {
             }
         }
     }
     catch (Exception e)
     {
         Console.WriteLine("ERROR: " + e.Message);
     }
 }
Пример #2
0
        public static void SetupCoreModules()
        {
            IEnumerable <Lazy <object, object> > exportEnumerable = _container.GetExports(typeof(CoreModule), null, null);

            foreach (Lazy <object, object> lazyExport in exportEnumerable)
            {
                IDictionary <string, object> metadata = (IDictionary <string, object>)lazyExport.Metadata;
                object nameObj;
                if (metadata.TryGetValue("Name", out nameObj))
                {
                    string name = (string)nameObj;
                    Console.WriteLine("Adding " + name + " Event Module.");
                    ModuleHandler.AddCoreModule(name, (CoreModule)lazyExport.Value);
                }
            }
            Console.WriteLine("Starting Core Modules.....");
            ModuleHandler.StartCoreModules();
            Console.WriteLine("Core Modules Started.....");
        }
Пример #3
0
        public void RunModuleCache()
        {
            int count = ModuleHandler.InvokeGetModuleAddonCount();
            int i     = 0;

            for (; i < count; i++)
            {
                object[] obj_temp  = ModuleHandler.InvokeGetModuleAddon(i, true);
                string   key       = (string)obj_temp[0];
                string[] split_key = key.Split(new char[1] {
                    '_'
                }, StringSplitOptions.RemoveEmptyEntries);
                if (split_key[0] == _ptype.ToString())
                {
                    obj_temp = ModuleHandler.InvokeGetModuleAddon(i, false);
                    key      = (string)obj_temp[0];
                    ModuleAddonCallback mac = (ModuleAddonCallback)obj_temp[1];
                    ModuleAddons.Add(key, mac);
                }
                else
                {
                }
            }
        }