On dirait un gars en manque de code :D
Class Main
Cliquez pour révéler
Cliquez pour masquer
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
using MyBot.Interface;
using MyBot.Divers;
using MyBot.Network;
using MyBot.Client;
using MyBot;
namespace MyBot
{
public partial class Main : Form
{
private ConsoleForm console = new ConsoleForm();
private Injection inject = new Injection();
public Main()
{
InitializeComponent();
}
private void mITMToolStripMenuItem_Click(object sender, EventArgs e)
{
inject.ProcessDofus();
}
private void afficherLaConsoleToolStripMenuItem_Click(object sender, EventArgs e)
{
console.Activate();
console.Show();
}
private void lancerDofusToolStripMenuItem_Click(object sender, EventArgs e)
{
Process.Start(@"D:\D\bots\app\Dofus.exe");
console.Add("Dofus a été lancé !", Color.Brown);
}
}
}
Class Console
Cliquez pour révéler
Cliquez pour masquer
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using MyBot.Interface;
using MyBot.Divers;
using MyBot.Network;
using MyBot.Client;
using MyBot;
namespace MyBot.Interface
{
public partial class ConsoleForm : Form
{
public ConsoleForm()
{
InitializeComponent();
}
public void Add(string log, Color color)
{
rtLog.SelectionColor = color;
rtLog.AppendText("[" + DateTime.Now.ToString("h:mm:ss tt") + "] : " + log + "\r\n");
}
public void Add(string log)
{
rtLog.AppendText("[" + DateTime.Now.ToString("h:mm:ss tt") + "] : " + log + "\r\n");
}
public void Add(byte[] buffer, string log, Color color)
{
rtLog.SelectionColor = color;
rtLog.AppendText("[" + DateTime.Now.ToString("h:mm:ss tt") + "] : " + log);
rtLog.SelectionColor = Color.Black;
for (int i = 0; i < buffer.Length; i++)
{
rtLog.AppendText(buffer.ToString() + "");
}
rtLog.AppendText("\r\n");
}
private void button1_Click(object sender, EventArgs e)
{
rtLog.Text = null;
}
private void rtLog_TextChanged(object sender, EventArgs e)
{
rtLog.SelectionStart = rtLog.Text.Length;
rtLog.ScrollToCaret();
}
private void btClose_Click(object sender, EventArgs e)
{
Hide();
}
}
}
Class Injection
Cliquez pour révéler
Cliquez pour masquer
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Diagnostics;
using MyBot.Interface;
using MyBot.Divers;
using MyBot.Network;
using MyBot;
namespace MyBot.Divers
{
public class Injection
{
private ConsoleForm console = new ConsoleForm();
public Injection() { }
public string ApplicationPath
{
get { return Environment.CurrentDirectory; }
}
public void Inject(int dofusModId)
{
try
{
if (!(File.Exists(ApplicationPath + "\\No.Ankama.dll")))
{
console.Add("Le fichier No.Ankama.dll ne se trouve pas dans le dossier ! Veuillez vérifier cela avec votre Antivirus.");
return;
}
DllInjector dllInjector = new DllInjector();
dllInjector.Inject(Convert.ToUInt32(dofusModId), ApplicationPath + "\\No.Ankama.dll");
console.Add("Processus Dofus à l'id = " + dofusModId + " a bien été patché !");
}
catch (Exception e)
{
console.Add(e.ToString(), Color.Red);
}
}
public void ProcessDofus()
{
Process[] proc;
try
{
proc = Process.GetProcessesByName("Dofus");
if (proc.Length == 0)
{
console.Add("Aucun processus Dofus trouvé.", Color.Red);
return;
}
for (int i = 0; i < proc.Length; i++)
{
console.Add("Processus Dofus trouvé avec l'id = " + proc.Id);
Inject(proc.Id);
}
}
catch (Exception e)
{
console.Add(e.ToString(), Color.Red);
}
}
}
}
Merci encore de votre aide :)
Je tiens à préciser que seule la classe Main arrive à afficher quelque chose sur la console.