Seitenhierarchie

  Wiki Navigation

    Loading...


 Recently Updated


 Latest Releases

 MediaPortal 1.32
            Releasenews | Download
 MediaPortal 2.5
            Releasenews | Download


Question

How do I check if another plugin is available and enabled?

Answer

Simply use the following code:

 

publicstatic bool IsAssemblyAvailable(string name,Version ver){
            bool result =false;
            Assembly[] assemblies =AppDomain.CurrentDomain.GetAssemblies();
            foreach(Assembly a in assemblies)
                try
                {
                    if(a.GetName().Name== name && a.GetName().Version>= ver)
                    {
                        result =true;
                        break;
                    }
                }
                catch
                {
                 
                }
            if(!result){
             
                try{
                    //Assembly assembly = AppDomain.CurrentDomain.Reflection(new AssemblyName(name));
                    Assembly assembly =Assembly.ReflectionOnlyLoad(name);
                    result =true;
                }
                catch(Exception e){
                }
            }
            return result;
        }
        public static bool IsPluginEnabled(string name){
            using (MediaPortal.Profile.Settings xmlreader =newMediaPortal.Profile.MPSettings()){
                return xmlreader.GetValueAsBool("plugins", name,false);
            }
        }

Source https://code.google.com/p/mptvseries/source/browse/trunk/MP-TVSeries/Helper.cs#701

   

 

This page has no comments.