topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday March 29, 2024, 8:00 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: FARR C# SDK and Documentation V2 (19/10/2008)  (Read 64213 times)

vitalyb

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 143
    • View Profile
    • Donate to Member
FARR C# SDK and Documentation V2 (19/10/2008)
« on: November 23, 2007, 11:23 PM »
Download link

http://vitalyb.dcmem...rs.com/CSharpSDK.zip

Installation
1) Unpack the attached zip to: \My Documents\Visual Studio 2005\Projects\FARR Plugins
2) Copy FARR C# plugin.zip from \My Documents\Visual Studio 2005\Projects\FARR Plugins to \My Documents\Visual Studio 2005\Templates\ProjectTemplates.

Tutorial
Developing C# plugins for FARR is now easier than ever. To create your first plugin follow these steps:
1) Run Visual Studio 2005
2) File -> New Project -> Visual C# ->  FARR C# plugin (if you don't see it here, make sure you did step 2 in the installation).
3) Set the location of the project to: \My Documents\Visual Studio 2005\Projects\FARR Plugins\ (make sure "Create directory for solution" is checked).
4) Enter a name for your plugin and press OK. For the sake of the example we'll call it SamplePlugin.
5) Compile it. It should automatically be copied to FARR plugin folder and then restart FARR.
6) When FARR comes up you can trigger your plugin by writing "SamplePlugin" (case sensitive!).

If all worked well, you should have your very own first plugin! Go ahead and customize for your own needs.

If something is broken, don't panic, it is rather easy to mess the whole plugin simply by deleting one line too much in the main FARR functions. Just go back step by step until you find which part you removed.

Enjoy!

Simplified SDK

As you can see from the generated template there are 3 main classes that you will need to use:

  • FARRCSharpPluginBase - The base class of all the plugins. Contains the metadata that describes the plugin and accepts in its constructor the main ActionList of the plugin.
  • ActionList - Represents a list of actions. Your plugin must have at least one ActionList. ActionList is called with a certain string that causes its ActionItems to be displayed.
  • ActionItem - Represents a single action on the list, part of the representation is the text that is displayed on the item but also the kind of action that happens when the user executes an item.

For further understanding I suggest to play with the various functions of the classes. You can find better examples of use in these plugins (ordered by complexity):
  • FARREnviormentVariables
  • FARRGoogleCalendar
  • FARRTunes

News
  • 19/10/2008 The simplified layer of that allows a more simple and object oriented design of plugins also there is a new template that simplifies the creation of new plugins.
  • 12/02/2008 I've uploaded a new version of SDK and all my C# plugins (FARRTunes, FARRAltTab and FARREnviormentVariables). It should resolve the following issues:
    • The problem with "FARR won't close after program launch" as described here: https://www.donation...ex.php?topic=12210.0
    • The error of "Unable to retreieve types" as described in the message-box picture below.
    • Now whenever there is an exception or an error you should see WHICH plugin was causing it.
    Make sure you update ALL 3 plugins (GCUpdater should help you out here). Besides that anyone that used SDK to create a plugin should get latest version and recompile (specifically, FARRGoogleSuggest).

What's in the package

  • InstallPlugin.exe - That's the part that is for all developers. If you put this little script to the "Post Build Event" (It exists most compilers) it will auto copy your plugin to FARR directory, close FARR and reopen it. This way, whenever you build your plugin, FARR is ready to test the latest version. For those who want to fiddle with the script I also included the source in InstallPlugin.ahk. For example, in my FARRAltTab plugin the PostBuild event looks like this:

    "$(SolutionDir)..\InstallPlugin.exe" "$(TargetDir)\" "C:\Program Files\FindAndRunRobot\Plugins\FARRAltTab\\"
  • FARR CSharp SDK.chm - I compiled using NDoc a pretty referece file, some was copied was Mouser documentation and some I wrote myself. It isn't complete but it is better than nothing :)
  • FARR CSharp SDK - The main solution that holds two projects. The first one is FARRPluginRCW which is written in CLI/C++ (managed C++) and holds the actual base class for all your C# plugins. The second project is the source of FARRAltTab. Use it as your main example as you develop your plugins
  • FARRAltTab source code - The source of the FARRAltTab plugin: https://www.donation...ex.php?topic=10988.0
  • FARRTunes source code - The source of the FARRTunes plugin: https://www.donation...ex.php?topic=11545.0

And more!

Known issues

  • If you don't see the C# plugin in the FARR plugin list after the installation then download the following update from Microsoft.
  • If you get the following messagebox:
            System.Exception: Unable to load the plugin C# assembly
            at FARRPluginRCW.LoadPlugin()
    It is probably because you got an old version of FARRAltTab. It is suggested to DELETE the folder of FARRAltTab and download the latest one.
  • Some people get the following error using some of plugins, it can be sometimes resolved by getting the latest version. This issue should be RESOLVED if it isn't, let me know: image.jpg
  • Currently there is a bug that limits the amount of active C# plugins to 1. If you are interested in developing a plugin, remove the FARRAltTab first from FARR plugin directory (See more info here).

Stay in touch

I will post all the updates/fixes for now to the SDK in this thread until it is deemed stable and can be merged with the main SDK.

Enjoy!
« Last Edit: October 19, 2008, 02:28 AM by vitalyb »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Awesome!!!!!  :-* :-* :-* :-* :-*

I will post all the updates/fixes for now to the SDK in this thread until it is deemed stable and can be merged with the main SDK.
sounds good  :up:

vitalyb

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 143
    • View Profile
    • Donate to Member
:)

By the way, even though I wrote "C#" in the post, any .NET language can be used instead with this SDK. From VB.NET to J# so truly anyone can now write a plugin!
If

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
By the way, even though I wrote "C#" in the post, any .NET language can be used instead with this SDK. From VB.NET to J# so truly anyone can now write a plugin!

 :huh:
COOL!

jpgrosen

  • Honorary Member
  • Joined in 2007
  • **
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
Hi,

Thanks for the .NET wrapper. I am trying to make a C# plugin but am faced with the following exception
System.NullReferenceException: Object reference not set to an instance of an object.
   at FARRPluginRCW.LoadPlugin()

I get the exception everytime I have both my plugin and FARRAltTab installed. (Or even if I just install the FARRAltTab plugin twice). Could it be an issue with the C++ wrapper?

Sincerely

JP

vitalyb

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 143
    • View Profile
    • Donate to Member
NullReferenceException is a .NET exception. What did you copy to FARR plugin directory?
Did you make your plugin directory with both the wrapper and your plugin inside?

jpgrosen

  • Honorary Member
  • Joined in 2007
  • **
  • default avatar
  • Posts: 8
    • View Profile
    • Donate to Member
Yes I copied both the wrapper and my plugin. I also got the exception (without my plugin folder) by simply dublicating the FARRAltTab plugin folder.

Sincerely JP

vitalyb

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 143
    • View Profile
    • Donate to Member
Hmm. Well. Unless you can debug it yourself, send me the files, see if I can reproduce it :)
I'll PM you my gmail.

vitalyb

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 143
    • View Profile
    • Donate to Member
While we're on the topic :)
Updated the AltTab source plugin to the current latest version (1.15) and updated the SDK. The only thing that got added is an option to send to FARR callback commands (e.g change the status bar).

vitalyb

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 143
    • View Profile
    • Donate to Member
I wanted to update potential developers on the status of the SDK.

Currently there is an issue with the amount of C# plugins you can put to FARR directory. The reason is that each FarrRCW.dll is .NET assembly and they are all identical in .NET sense (same identity). Basically it means that for every C# plugin there must be a unique RCW dll (and not just a copy as I thought).

Now, recompiling the RCW dll is relatively easy process (rename project & recompile) however, not everyone have C++ compilers and I am aware that many programmers out there never did anything beside C# and possibly don't have anything that can compile C++ installed. I still hope I can find a way to let anyone just change the RCW dll identity without any additional tools as the only other alternative I see now, is forcing people to recompile SDK everytime they want to develop a plugin.

In the while, if you have a plugin you want to develop, simply remove FARRAltTab from your plugins during development process so you'll always have only one C# plugin. If you want to publish it, let me know and I'll send you a unique RCW dll.

Hope it will get solved soon :(.

vitalyb

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 143
    • View Profile
    • Donate to Member
Well, I solved this issue.

Basically each time you will compile your plugin, it will compile in the background you very own RCW version. I'll upload the latest version of SDK along with the instructions (a bit more complex then before, I'm afraid) later.

In the while, here's something little from a future add-in I am developing:

FARRTunes.png

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
cooool

vitalyb

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 143
    • View Profile
    • Donate to Member
Uploaded the latest SDK that fixes the bug mentioned by jpgrosen (it was a bitch). Also includes the source of FARRTunes.

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
awesome!

vitalyb

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 143
    • View Profile
    • Donate to Member
Inlcuded the current list of issues people are having with C# plugins. Please anyone who still has problems (new ones or the ones listed here) post here and tell which ones so I can assess the seriousness of each issue.

vitalyb

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 143
    • View Profile
    • Donate to Member
Updated SDK and plugins - Main issues should be resolved.
Please read News in first post.

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,959
    • View Profile
    • Donate to Member
Updated SDK and plugins - Main issues should be resolved.
Please read News in first post.

great stuff Vitaly !!
do you know should these plugins (your three) show in dcupdater?

They're not showing here - so I'm unsure where to download?
Tom

vitalyb

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 143
    • View Profile
    • Donate to Member
I thought they are =\

Here are links to threads:
FARR AltTab - https://www.donation...ndex.php?topic=10988
FARR Environment Variables - https://www.donation...ndex.php?topic=11551
FARR Tunes - https://www.donation...ndex.php?topic=11545

There is also this one, but it isn't mine and right now it is probably not using the latest SDK so *might* have mentioned issues:
FARR Google Suggest - https://www.donation...ndex.php?topic=11556
« Last Edit: February 12, 2008, 01:38 PM by vitalyb »

Perry Mowbray

  • N.A.N.Y. Organizer
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 1,817
    • View Profile
    • Donate to Member
I'm having some simple startup issues Vitaly:

For a quick start, you should copy one of the sample plugins, change the name and go slowly from there by deleting the parts you don't need.

OK, I think I've changed names everywhere I need to? eg: added "Test_" to your FARRAltTab.

But when building I get the following errors:
  • /OUT:FARRPluginRCW.dll directive in .EXP differs from output filename 'G:\Documents\My Development\FARR Plugins\CSharpSDK\FARR CSharp SDK\Debug\Test_FARRAltTabRCW.dll'; ignoring directive   G:\Documents\My Development\FARR Plugins\CSharpSDK\Copy of FARRAltTab\Test_FARRAltTabRCW.exp   Test_FARRAltTab
  • /DELAYLOAD:OleAcc.dll ignored; no imports found from OleAcc.dll   G:\Documents\My Development\FARR Plugins\CSharpSDK\Copy of FARRAltTab\LINK   Test_FARRAltTab
  • precompiled object not linked in; image may not run   G:\Documents\My Development\FARR Plugins\CSharpSDK\Copy of FARRAltTab\JrPlugin_GenericShell.obj   Test_FARRAltTab
  • 1 unresolved externals   G:\Documents\My Development\FARR Plugins\CSharpSDK\FARR CSharp SDK\Debug\Test_FARRAltTabRCW.dll   Test_FARRAltTab
  • The command ""G:\Documents\My Development\FARR Plugins\CSharpSDK\Copy of FARRAltTab\..\FARR CSharp SDK\FARRPluginRCW\ProjectNameChanger.exe" "G:\Documents\My Development\FARR Plugins\CSharpSDK\Copy of FARRAltTab\..\FARR CSharp SDK\FARRPluginRCW\FARRPluginRCW.vcproj" Test_FARRAltTabRCW
    %windir%\Microsoft.NET\Framework\v2.0.50727\MSBuild.exe "G:\Documents\My Development\FARR Plugins\CSharpSDK\Copy of FARRAltTab\..\FARR CSharp SDK\FARRCSharpSDK.sln"
    xcopy /Y "G:\Documents\My Development\FARR Plugins\CSharpSDK\Copy of FARRAltTab\..\FARR CSharp SDK\debug\Test_FARRAltTabRCW.dll" "G:\Documents\My Development\FARR Plugins\CSharpSDK\Copy of FARRAltTab\"" exited with code 4.   Test_FARRAltTab

What am I doing wrong???  :huh:


fenixproductions

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 1,186
    • View Profile
    • Donate to Member
Is it working with VS 2008 Express editions?
I have both, C# and C++ environments here but compilation always stops on "VCBuild.exe cannot be found" message.

It is strange because:
1. I have such file in my VS directory structure,
2. report says that I should have .NET farmework 2.x installed even if I have it.

vitalyb

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 143
    • View Profile
    • Donate to Member
Re: FARR C# SDK and Documentation V2 (19/10/2008)
« Reply #20 on: October 18, 2008, 05:55 PM »
Is it working with VS 2008 Express editions?
I have both, C# and C++ environments here but compilation always stops on "VCBuild.exe cannot be found" message.
-fenixproductions (September 26, 2008, 08:08 AM)

I only tried compiling with VS 2005. Try its express edition maybe?

vitalyb

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 143
    • View Profile
    • Donate to Member
Re: FARR C# SDK and Documentation V2 (19/10/2008)
« Reply #21 on: October 18, 2008, 05:57 PM »
I've uploaded a new version of the C# SDK. It now includes a simplified layer that allows more object oriented plugins to be created easily.

Also, it now includes template for those that got a bit confused with the numerous post/pre build events and the whole integration process.
Hopefully now it will just work :).

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: FARR C# SDK and Documentation V2 (19/10/2008)
« Reply #22 on: October 18, 2008, 06:05 PM »
awesome!  :Thmbsup: :Thmbsup: :Thmbsup: :Thmbsup: :Thmbsup: :Thmbsup: :Thmbsup: :Thmbsup: :Thmbsup: :Thmbsup: :Thmbsup: :Thmbsup: :Thmbsup: :Thmbsup: :Thmbsup: :Thmbsup: :Thmbsup:

Perry Mowbray

  • N.A.N.Y. Organizer
  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 1,817
    • View Profile
    • Donate to Member
Re: FARR C# SDK and Documentation V2 (19/10/2008)
« Reply #23 on: November 16, 2008, 07:25 PM »
Hi Vitaly:

Windows is reporting tour zip file is invalid/corrupted:
Screenshot - 17_11_2008 , 12_23_38 PM.png

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: FARR C# SDK and Documentation V2 (19/10/2008)
« Reply #24 on: November 16, 2008, 07:38 PM »
Perry -- i got same error as you; then i opened file in text editor and saw it was a .rar filel
if you rename to .rar and have a program that can open .rar files it will open ok.

hopefully vitaly can repack as a zip later.
« Last Edit: November 16, 2008, 07:47 PM by mouser »