Re: [Banshee-List] Integration with NewStuffManager
- From: Sebastian Pölsterl <marduk k-d-w org>
- To: banshee-list gnome org
- Subject: Re: [Banshee-List] Integration with NewStuffManager
- Date: Wed, 11 Oct 2006 23:21:15 +0200 (CEST)
Isak Savo wrote:
> 2006/10/11, Sebastian Pölsterl <marduk k-d-w org>:
>> Hi!
>>
>> I'm the author of NewStuffManager
>> (http://www.k-d-w.org/clipboard/NewStuffManager) and would love to see
>> banshee using it.
>>
>> I already did some work. But I got some questions:
>>
>> - What would be the best to use as an unique id for the plugins. This id
>> should help unloading and reloading the plugins. Currently, I'm using
>> plugin.GetType().Module.Name as plugin_id. I have the idea that new
>> FileInfo( Path.Combine(Paths.UserPluginDirectory, plugin_id) ) could
>> reload the plugin. Does that actually work?
>
> Depending on what you want to do with it, and how unique it has to be,
> there are some options: (replace "typeof(TheClass)" with
> "MyInstanceOfTheClass.GetType()" if needed)
>
> * typeof(TheClass).GUID is *the* unique identifier for a class.
> Unfortunatly, this only works if the class defines a GUID in the first
> place (using System.Runtime.InterropService.GuidAttribute on the
> class) which they probably don't do.
>
> * typeof(TheClass).FullName will give you the fully qualified name of
> the class, that is "NameSpace.TheClass" which should be fairly unique.
>
> * typeof(TheClass).Name which will give you the class name, without
> namespace information.
>
> * And as you mentioned yourself, you can also use the actual DLL file
> name from the Module member.
>
> Regarding reloading the plugins, you need to use reflection again. But
> as microsoft decided that DLL's cannot be unloaded at runtime once
> they are loaded, this will only work if they were loaded into a
> separate AppDomain (which can be destroyed, which effectively unloads
> all its assemblies). Maybe mono doesn't have this limitation, not
> sure.
>
Can the plugins be unloaded at runtime in banshee, or is a restart required?
>> - Afaik the each plugin hasn't its own version atm (please correct me).
>> But this would be neccesary to compare versions.
>
> You can always get the version info by reflecting the assembly where
> the type is defined (i.e. the plugin's DLL file):
>
> Version thisVersion = typeof(TheClass).Assembly.GetName().Version
> Version repositoryVersion = new Version(versionString);
> if (thisVersion < repositoryVersion)
> TellUserThatThereAreUpdatesAvailable();
>
> The Version class consists of the fields "Major", "Minor", "Build" and
> "Revision", but the overloaded comparison operators should be
> sufficient for you.
>
> This method depends on that the plugins define their correct versions
> in their respective AssemblyInfo.cs file. Not sure if this is the case
> (they *should* do so, so it's a bug if the don't IMHO). By default,
> .NET assemblies will have version 1.0.x.y where x and y is auto
> incremented by the compiler.
>
A look into source files if Banshee.Plugins reveals that currently no
plugin has a AssemblyInfo.cs. So I guess there's work to do.
--
Greetings,
Sebastian Pölsterl
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]