CXLoader

04/28/2010 14:05 high9#1
This is what CoPackets uses to get/send the packets while loaded in conquer.

[Only registered and activated users can see links. Click Here To Register...]

So CXLoader loads up CoPackets and then calls "CX_Startup" passing the 2 functions that you call to send and receive packets. It then looks for functions names "CX_Send" and "CX_Recv" and calls those when packets are sent and received.

This is what the main part of CoPackets looks like.
Code:
	public class SendRecvClass
	{
		static SendRecvClass self;
		public static SendRecvClass Self
		{
			get
			{
				if (self == null)
					self = new SendRecvClass();
				return self;
			}
		}
		public MulticastDelegate SendFunc;
		public MulticastDelegate RecvFunc;
		public void Send(byte[] b)
		{
			SendFunc.DynamicInvoke(b);
		}
		public void Recv(byte[] b)
		{
			RecvFunc.DynamicInvoke(b);
		}
		public static void CX_Send(byte[] b)
		{
			bool block = false;

			if (Self.OnSend != null)
				Self.OnSend(b, ref block);

			if (!block)
				Self.Send(b);
		}

		public static void CX_Recv(byte[] b)
		{
			bool block = false;

			if (Self.OnRecv != null)
				Self.OnRecv(b, ref block);

			if (!block)
				Self.Recv(b);
		}

		public delegate void OnSendD(byte[] b, ref bool block);
		public event OnSendD OnSend;

		public delegate void OnRecvD(byte[] b, ref bool block);
		public event OnRecvD OnRecv;

	}

	public class Startup
	{
		public static void Start()
		{
			Application.EnableVisualStyles();
			Application.SetCompatibleTextRenderingDefault(false);
			Application.Run(new MainForm());
		}
		public static void CX_Startup(Object ps1, Object ps2)
		{
			SendRecvClass.Self.SendFunc = (MulticastDelegate)ps1;
			SendRecvClass.Self.RecvFunc = (MulticastDelegate)ps2;

			Thread t = new Thread(new ThreadStart(Start));
			t.Start();
		}
	}
So to get the packets sent and received you do
Code:
			SendRecvClass.Self.OnSend += new SendRecvClass.OnSendD(Self_OnSend);
			SendRecvClass.Self.OnRecv += new SendRecvClass.OnRecvD(Self_OnRecv);
And to send packets packets to the client you do

Code:
SendRecvClass.Self.Send(ByteArray);
SendRecvClass.Self.Recv(ByteArray);
04/28/2010 14:42 Warlax#2
lol wonder how long before the next set of memory proxies start flying out :P
04/29/2010 00:18 waellove#3
can u explain for what i use that prog in conq
04/29/2010 00:19 jediderek1#4
High is always on top of these things. Thanks for releasing it.
05/04/2010 17:29 BEanErzzz#5
Nifty