update: Par manque de temps pour travailler sur le projet, nous avons décidés de faire un release des sources. Je vais continuer à travailler la dessus tranquillement mais je n'ai pas énormément de temps devant moi ces temps ci. Maxilia semble très occupé également et je n'ai pas l'impression qu'il va continuer à contribuer pour un bon moment. C'est pouquoi nous vous donnons accès aux sources non seulement de EuuBot.Relay mais du projet en entier. vous y trouverez un générateur automatique de code et quelques extras. Comme je n'ai pas vraiment le temps d'expliquer tout ca, posez vos questions si vous en avez et j'y répondrai.
Bonjour à tous. Voici le premier beta de EuuBot.Relay. Il vous sera possible dés maintenant d'essayer ce bot et de développer de nouveaux plugins. Attention par contre, ce bot étant beta, beaucoup de choses pourraient changer et nous n'avons pas de garanti de stabilité.
Nous allons fournir des tutoriels pour l'installation initiale du bot et pour le développement de plugin très bientôt. Entre-temps, je met quand même la version beta pour les plus courageux d'entre vous qui voudraient l'essayer sans tutoriel! N'hésitez pas à poser des questions si vous en avez!
Note: ce logiciel requiert le framework .NET 4.0.
Voici le code d'un des plugin, vous pourrez vous y référer en attendant la documentation qui devrait sortir au courant de la semaine.
Cliquez pour révéler
Cliquez pour masquer
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EuuBot.Relay.PluginInterfaces;
using EuuBot.Relay.PluginInterfaces.Host;
using EuuBot.Debugging.Logging;
namespace EuuBot.Relay.Plugins.Sniffer
{
[PluginInformation("Sniffer", "Interpret dofus packets", "MikeDotNet", "1.0.0")]
public class SnifferPlugin : IConnectionPlugin , IFormPlugin, ILoggable
{
private SnifferForm _snifferForm;
private IPluginHost _host;
#region IPlugin Membres
/// <summary>
/// Gets a value indicating whether auto loading of the plugin during the connection phase is required.
/// A plugin with this property set to true will not allow user to use the plugin as an on-demand plugin.
/// </summary>
/// <value>
/// <c>true</c> if auto loading of the plugin during the connection phase is required; otherwise, <c>false</c>.
/// </value>
public bool ForceAutoLoad
{
get
{
return false;
}
}
/// <summary>
/// Initiate the plugin.
/// Be carefull to do the minimal in here as there could be potential problems.
/// For example, requesting a shared plugin here could result in an error if the plugin has not yet been loaded.
/// </summary>
/// <param name="host">The hosting application interface</param>
public void Initiate(IPluginHost host)
{
_host = host;
_snifferForm = new SnifferForm();
}
/// <summary>
/// Process a Client->Server packet
/// </summary>
/// <param name="packet">The ClientPacket object</param>
/// <returns>
/// Keep : the packet will be relayed to the server.
/// Drop : the packet will not be relayed to the server.
/// </returns>
public PacketAction ProcessClientPacket(Packets.ClientPacket packet)
{
_snifferForm.HandleReceivedPacket(packet);
return PacketAction.Keep;
}
/// <summary>
/// Process a Server->Client packet
/// </summary>
/// <param name="packet">The ServerPacket object</param>
/// <returns>
/// Keep : the packet will be relayed to the client.
/// Drop : the packet will not be relayed to the client.
/// </returns>
public PacketAction ProcessServerPacket(Packets.ServerPacket packet)
{
_snifferForm.HandleReceivedPacket(packet);
return PacketAction.Keep; // Sa
}
#endregion
#region IDisposable Membres
private bool _disposed = false;
/// <summary>
/// Exécute les tâches définies par l'application associées à la libération ou à la redéfinition des ressources non managées.
/// </summary>
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
/// <summary>
/// Releases unmanaged and - optionally - managed resources
/// </summary>
/// <param name="disposing"><c>true</c> to release both managed and unmanaged resources; <c>false</c> to release only unmanaged resources.</param>
protected virtual void Dispose(bool disposing)
{
if (!_disposed)
{
if (disposing)
{
//dispose managed things, for example close running threads.
//Do not dispose the form, it is taken care by the plugin manager
}
//dispose unmanaged code
_disposed = true;
}
}
#endregion
#region IFormPlugin Membres
/// <summary>
/// Called when the host application requests the form for the plugin
/// </summary>
/// <returns>
/// A System.Windows.Form defined by the plugin
/// </returns>
public System.Windows.Forms.Form GetPluginForm() // Ici une fonction qui retourne la form (c'est pour l'afficher ensuite)
{
return _snifferForm;
}
#endregion
#region ILoggable Membres
public Guid DebugKey
{
get { return _debugKey; }
}
private Guid _debugKey = Guid.NewGuid();
public event EventHandler<LogEventArgs> Log;
protected void onLog(string text)
{
onLog(text, LogType.Info);
}
protected void onLog(string text, LogType logType)
{
if (Log != null)
Log(this, new LogEventArgs(text, this.DebugKey));
}
#endregion
}
}
Restez à l'affût ici même pour des updates et la documentation à venir!
Guide de configuration