Пример #1
0
 private void OnUtilityAddinDisable(Mono.Addins.ExtensionNodeEventArgs args)
 {
     Mono.Addins.TypeExtensionNode node = args.ExtensionNode as Mono.Addins.TypeExtensionNode;
     try
     {
         OnDisableAddin(node.Id);
     }
     catch (Exception ex)
     {
         Log.Error("Error unloading add-in: " + ex.Message);
     }
 }
Пример #2
0
 private void PrintInfo(string extPoint, ExtensionNodeEventArgs args, Mono.Addins.TypeExtensionNode extNode)
 {
     Log.Debug("###########################");
     Log.Debug($"'{extPoint}'");
     Log.Debug($"  Id      - '{args.ExtensionNode.Id}'");
     Log.Debug($"  Path    - '{args.Path}'");
     Log.Debug($"  Node    - '{args.ExtensionNode}'");
     Log.Debug($"  Object  - '{args.ExtensionObject}'");
     Log.Debug($"  Changed - '{args.Change.ToString()}'");
     Log.Debug("   --[ ExtensionNode ]------");
     Log.Debug($"  Id      - '{extNode.Id}'");
     Log.Debug($"  ToString- '{extNode.ToString()}'");
     Log.Debug($"  TypeName- '{extNode.TypeName}'");
 }
Пример #3
0
        internal PotentialSource(DapService service, TypeExtensionNode claimant, IDevice device)
        {
            Claimant = claimant;
            Service = service;

            IsTemporary = true;

            SupportsPlaylists = false;
            SupportsPodcasts = false;
            SupportsVideo = false;

            DeviceInitialize (device, false);
            Initialize ();
        }
Пример #4
0
        private void OnStartupAddins_ExtensionHandler(object sender, Mono.Addins.ExtensionNodeEventArgs args)
        {
            Log.Debug("Entering");

            Mono.Addins.TypeExtensionNode extNode = args.ExtensionNode as Mono.Addins.TypeExtensionNode;
            PrintInfo(ExtensionPath.OnStartup, args, extNode);

            // Execute via class interface definition of extension path
            // IOnStartupExtension ext = (IOnStartupExtension)args.ExtensionObject;
            IOnStartupExtension addin = extNode.GetInstance(typeof(IOnStartupExtension)) as IOnStartupExtension;

            addin.Execute();

            // Push event changed out to listeners
            OnApplicationAddinListChanged?.Invoke(sender, args);
        }
Пример #5
0
        private void StartupHandler_ExtensionChanged(object sender, Mono.Addins.ExtensionNodeEventArgs args)
        {
            LogDebug("OnStartChanged {");
            LogDebug($"  Path    - {args.Path}");
            LogDebug($"  Node    - {args.ExtensionNode}");
            LogDebug($"  Object  - {args.ExtensionObject}");
            LogDebug($"  Changed - {args.Change.ToString()}");

            Mono.Addins.TypeExtensionNode extNode = args.ExtensionNode as Mono.Addins.TypeExtensionNode;
            LogDebug($"  ExtNode: {extNode.ToString()}");

            LogDebug("  Running...");
            IStartupExtension ext = (IStartupExtension)args.ExtensionObject;

            ext.Run();

            LogDebug("}");
        }
Пример #6
0
        /// <summary>Load utility add-ins</summary>
        public void LoadUtilityAddins()
        {
            Mono.Addins.ExtensionNodeList nodes = Mono.Addins.AddinManager.GetExtensionNodes(ExtensionPath.Utility);
            foreach (Mono.Addins.ExtensionNode node in nodes)
            {
                Mono.Addins.TypeExtensionNode typeNode = node as Mono.Addins.TypeExtensionNode;

                try
                {
                    UtilityAddin utility = typeNode.CreateInstance() as UtilityAddin;

                    LoadUtilityAddin(utility, typeNode.Id, typeNode.TypeName);
                }
                catch (Exception ex)
                {
                    Log.Error("Couldn't create UtilityAddin: " + ex.Message);
                }
            }
        }
Пример #7
0
        public List <IPreferencePageExtension> GetPreferenceAddins()
        {
            List <IPreferencePageExtension> pages = new List <IPreferencePageExtension>();

            Mono.Addins.ExtensionNodeList nodes = Mono.Addins.AddinManager.GetExtensionNodes(ExtensionPath.PreferencePage);
            foreach (Mono.Addins.ExtensionNode node in nodes)
            {
                Mono.Addins.TypeExtensionNode typeNode = node as Mono.Addins.TypeExtensionNode;
                try
                {
                    IPreferencePageExtension page = typeNode.CreateInstance() as IPreferencePageExtension;
                    page.InitializePage();
                    page.Id = node.Id;
                    pages.Add(page);
                }
                catch (Exception ex)
                {
                    Log.Error("Couldn't create PreferencePage: " + ex.Message);
                }
            }

            return(pages);
        }
Пример #8
0
        private void OnStartupExtensionChanged(object sender, Mono.Addins.ExtensionNodeEventArgs args)
        {
            Log.Debug("###########################");
            Log.Debug("OnStartChanged {");
            Log.Debug($"  Id      - '{args.ExtensionNode.Id}'");
            Log.Debug($"  Path    - '{args.Path}'");
            Log.Debug($"  Node    - '{args.ExtensionNode}'");
            Log.Debug($"  Object  - '{args.ExtensionObject}'");
            Log.Debug($"  Changed - '{args.Change.ToString()}'");

            Mono.Addins.TypeExtensionNode extNode = args.ExtensionNode as Mono.Addins.TypeExtensionNode;
            Log.Debug("   --[ ExtensionNode ]------");
            Log.Debug($"  Id      - '{extNode.Id}'");
            Log.Debug($"  ToString- '{extNode.ToString()}'");
            Log.Debug($"  TypeName- '{extNode.TypeName}'");
            Log.Debug("# # # # # # # # # # #");

            Log.Debug("  Running...");
            IStartupExtension ext = (IStartupExtension)args.ExtensionObject;

            ext.Run();

            Log.Debug("}");
        }
        /// <summary>
        /// Check that the given module is no disabled in the [Modules] section of the config files.
        /// </summary>
        /// <param name="node"></param>
        /// <param name="modulesConfig">The config section</param>
        /// <returns>true if the module is enabled, false if it is disabled</returns>
        protected bool CheckModuleEnabled(TypeExtensionNode node, IConfig modulesConfig)
        {
            // Get the config string
            string moduleString =
                    modulesConfig.GetString("Setup_" + node.Id, String.Empty);

            // We have a selector
            if (moduleString != String.Empty)
            {
                // Allow disabling modules even if they don't have
                // support for it
                if (moduleString == "disabled")
                    return false;

                // Split off port, if present
                string[] moduleParts = moduleString.Split(new char[] { '/' }, 2);
                // Format is [port/][class]
                string className = moduleParts[0];
                if (moduleParts.Length > 1)
                    className = moduleParts[1];

                // Match the class name if given
                if (className != String.Empty &&
                        node.Type.ToString() != className)
                    return false;
            }            
            
            return true;
        }        
Пример #10
0
 private void LoadEngine(TypeExtensionNode node)
 {
     LoadEngine ((PlayerEngine) node.CreateInstance (typeof (PlayerEngine)));
 }
        private void AddNode(
            TypeExtensionNode node, IConfig modulesConfig, Dictionary<RuntimeAddin, IList<int>> loadedModules)
        {
            IList<int> loadedModuleData;

            if (!loadedModules.ContainsKey(node.Addin))
                loadedModules.Add(node.Addin, new List<int> { 0, 0, 0 });

            loadedModuleData = loadedModules[node.Addin];

            if (node.Type.GetInterface(typeof(ISharedRegionModule).ToString()) != null)
            {
                if (CheckModuleEnabled(node, modulesConfig))
                {
                    m_log.DebugFormat("[REGIONMODULES]: Found shared region module {0}, class {1}", node.Id, node.Type);
                    m_sharedModules.Add(node);
                    loadedModuleData[0]++;
                }
            }
            else if (node.Type.GetInterface(typeof(INonSharedRegionModule).ToString()) != null)
            {
                if (CheckModuleEnabled(node, modulesConfig))
                {
                    m_log.DebugFormat("[REGIONMODULES]: Found non-shared region module {0}, class {1}", node.Id, node.Type);
                    m_nonSharedModules.Add(node);
                    loadedModuleData[1]++;
                }
            }
            else
            {
                m_log.WarnFormat("[REGIONMODULES]: Found unknown type of module {0}, class {1}", node.Id, node.Type);
                loadedModuleData[2]++;
            }
        }