Google Desktop Winamp Plugin - C#

Yesterday I submitted my first Plugin for GD - .NET/C# of course.  It has basic the controls: play/pause/stop/next/prev and displays the title of the track currently playing.  I think the hardest part was to get the installer working right.  Now that I look back it was quite simple I was just looking at all the wrong places. 

All I did was take their SamplePlugin project and ripped out 90% of it, and stuff it some basic Winamp control features. 

One thing I did not like and, for the life of me, could not see how to have the items in the list respond to a single click instead of a double click.  Thus, in order to do anything with it you have to double click the items.  If Google ever approves of it, and it is put online on their site, I will repost the URL...If your really excited and want it right now, send me some feedback and I can forward  you my internal URL for it.

The Big Gotcha's:

1. Adding Google's references:  GoogleDesktopAPILib, and GoogleDesktopDisplayLib.  Make sure you have specified a "Wrapper Assembly Key File" to your plugin project PRIOR to adding those references.  Oh yes, that does imply that you have to use "sn" to generate the key file before.  You also do not need to have their C++ project included in your plugin solution.  Just the references of course.

2. Create a Plugin Installer class:

using System;

using System.Runtime.InteropServices;

namespace GoogleDesktopScreenCapture {

[System.ComponentModel.RunInstaller(true)]

public class PluginInstaller : System.Configuration.Install.Installer {

public PluginInstaller() {

}

public override void Install(System.Collections.IDictionary stateSaver) {

base.Install (stateSaver);

RegistrationServices regsrv = new System.Runtime.InteropServices.RegistrationServices();

if(!regsrv.RegisterAssembly(this.GetType().Assembly,System.Runtime.InteropServices.AssemblyRegistrationFlags.SetCodeBase)) {

throw new System.Exception("Failed to register object");

}

}

public override void Uninstall(System.Collections.IDictionary savedState) {

base.Uninstall (savedState);

RegistrationServices regsrv = new RegistrationServices();

if(!regsrv.UnregisterAssembly(this.GetType().Assembly)) {

throw new System.Exception("Failed to unregister object");

}

}

}

}

You can copy that exact class above, no changes are needed as long as it is in the same assembly as your actual plugin.  Now, in your installer open the "Custom Actions" and add the "Primary Output" to both the Install and Uninstall sections and be sure to set the "InstallerClass" to true in the properties on the newly added nodes.

3. You dont need to stuff anything in the GAC, unless maybe you have other assemblies which your stuff is using.  My entire plugin consist of a single DLL which I allowed for the default install to happen.

If you have any problems getting your .NET GD Plug-ins working feel free to use the feedback and I can try to solve some of them with you...

 

5 Comments

Comments have been disabled for this content.