How to make Eternity Client plugins in ANY .NET language

Discussion in 'Programming General' started by Blupig, Feb 15, 2011.

How to make Eternity Client plugins in ANY .NET language
  1. Unread #1 - Feb 15, 2011 at 8:51 PM
  2. Blupig
    Joined:
    Nov 23, 2006
    Posts:
    7,145
    Referrals:
    16
    Sythe Gold:
    1,609
    Discord Unique ID:
    178533992981594112
    Valentine's Singing Competition Winner Member of the Month Winner MushyMuncher Gohan has AIDS Extreme Homosex World War 3 I'm LAAAAAAAME
    Off Topic Participant

    Blupig BEEF TOILET
    $5 USD Donor

    How to make Eternity Client plugins in ANY .NET language

    IMPORTANT: Before you start, you need to know that all plugins you make MUST be written using the same .NET Framework as Eternity Client's. No older, no newer. Currently, Eternity uses Microsoft's .NET Framework 3.5.

    If you have a full copy of Visual Studio 2008 or 2010, you can change your new project's framework like so:

    [​IMG]

    Don't have Visual Studio 2008 or 2010? Don't worry! Here are a few useful, free, and clean links to the Express editions of the 2008 suite:
    Visual Basic.NET 2008 Express
    Visual C# 2008 Express
    Visual C++.NET 2008 Express (Note: only C# and VB are used in this tutorial)

    Alright, let's get started!
    1. Create a new project, but select "Class Library" and make sure your framework is set to 3.5 if you're using Visual Studio.
    2. Add PluginPortal.dll as a reference in your project (it's in your Eternity Client install folder). Don't know how? Follow these steps:
      [​IMG]
      - Double-click "My Project"
      - Click the "References" tab on the left of the window
      - Click the "Add" button

      [​IMG]

      - Click the "Browse" tab, and select PluginPortal.dll
    3. You'll need the following code to make your plugin work; it's all commented already, so you'll be able to understand each line.

      For programmers making plugins in VB:
      Code:
      ' ' Import the plugin functions so we can attach it to Eternity
      Imports PluginPortal.PluginPortal
      
      ' ' Create the namespace for the class (create the section of code which will be our class)
      Public Class Class1
      
          ' ' Implement the plugin framework to be able to use its properties and functions
          Implements IPlugin
      
          ' ' Define the plugin's name
          Public ReadOnly Property Name() As String Implements IPlugin.Name
              Get
                  Return "Your plugin name"
              End Get
          End Property
      
          ' ' Define the plugin's description
          Public ReadOnly Property Description() As String Implements IPlugin.Description
              Get
                  Return "Your plugin description"
              End Get
          End Property
      
          ' ' Define your name (if you're the author of the plugin!)
          Public ReadOnly Property Author() As String Implements IPlugin.Author
              Get
                  Return "Your name"
              End Get
          End Property
      
          ' ' This is the code that will happen when your plugin is loaded from the plugin loader in the client
          ' ' The argument "form" is simply a reference to the client's main form, which means that you can 
          ' ' directly modify the client's main form if you want to.
          Public Sub initialize(ByRef form As Object) Implements IPlugin.initialize
      
              ' ' This is where all your startup code will go
              ' ' If you want forms or additional classes, add them like you normally would
              ' ' (Right-click your project's name in the panel in the top right corner where "My Project" also is
              ' ' and select "Add..." then what you want to add)
      
      
              ' ' Because we're in a class file, you need to create a new instance of your form like so, 
              ' ' if you want to show it on startup (replace "Form1" with your form's name).
              Dim MyForm As New Form1
      
              ' ' The first line incorportates your new form into Eternity; this means that it takes full advantage
              ' ' of the multi-window tab system and becomes part of Eternity like any other feature.
              ' ' Skip this line (don't do it) if you want your plugin to appear in a completely separate window.
              MyForm.MdiParent = form
      
              ' ' ...And this is the code to show your new form. From here on out all of your code can be done on your
              ' ' form if you so choose.
              MyForm.Show()
      
          End Sub
      End Class
      For programmers making plugins in C#:
      Code:
      // Regular imports. If you get any errors, add "using Microsoft.VisualBasic;" as well.
      using System;
      using System.Collections;
      using System.Collections.Generic;
      using System.Data;
      using System.Diagnostics;
      
      // Import the plugin functions so we can attach it to Eternity
      using PluginPortal.PluginPortal;
      
      // Implement the plugin framework to be able to use its properties and functions
      public class Class1 : IPlugin
      {
      
      	// Define the plugin's name
      	public string Name {
      		get { return "Your plugin name"; }
      	}
      
      	// Define the plugin's description
      	public string Description {
      		get { return "Your plugin description"; }
      	}
      
      	// Define your name (if you're the author of the plugin!)
      	public string Author {
      		get { return "Your name"; }
      	}
      
      	// This is the code that will happen when your plugin is loaded from the plugin loader in the client
      	// The argument "form" is simply a reference to the client's main form, which means that you can 
      	// directly modify the client's main form if you want to.
      	public void initialize(ref object form)
      
      		// This is where all your startup code will go
      		// If you want forms or additional classes, add them like you normally would
      		// (Right-click your project's name in the panel in the top right corner where "My Project" also is
      		// and select "Add..." then what you want to add)
      
      
      		// Because we're in a class file, you need to create a new instance of your form like so, 
      		// if you want to show it on startup (replace "Form1" with your form's name).
      		Form1 MyForm = new Form1();
      
      		// The first line incorportates your new form into Eternity; this means that it takes full advantage
      		// of the multi-window tab system and becomes part of Eternity like any other feature.
      		// Skip this line (don't do it) if you want your plugin to appear in a completely separate window.
      		MyForm.MdiParent = form;
      
      		// ...And this is the code to show your new form. From here on out all of your code can be done on your
      		// form if you so choose.
      		MyForm.Show();
      
      	}
      }
      I don't know C++, but if any C++ programmers out there want to port the example code please PM me.
    4. Once you've compiled and completed your new plugin, you can put it in the "Plugins" folder in the Eternity install directory. The client will detect it automatically.

    Additionally, if you're lazy like me then you can reference Eternity.exe and use all its functions :p I'll be making a full documentation of what can be used soon. Feel free to poke around the different libraries it has though, everything is very straight-forward.

    Thanks for using Eternity Client, if you want me to review your finished plugins PM me :)
     
  3. Unread #2 - Feb 15, 2011 at 9:25 PM
  4. cazax
    Joined:
    Nov 13, 2007
    Posts:
    457
    Referrals:
    0
    Sythe Gold:
    0

    cazax Forum Addict

    How to make Eternity Client plugins in ANY .NET language

    Nice stuff :) Well written and good documentation too, though I'm not into .NET. Nifty anyway.
     
< Looking for a talented c++ Coder! | Reconfiguring a Time Matrix >

Users viewing this thread
1 guest


 
 
Adblock breaks this site