Hey everyone.
This was a request by a few friends of mine to make a simple, managed packet writer for C#. You can use it to create packets of all different styles. Using it is easy as well. I'll give you all a few examples of what it can do and how to use it in a minute. First, here's the download for the source code. You may also choose to download it in the form of a dll (which is available through my mediafire account).
Source Download: [Only registered and activated users can see links. Click Here To Register...]
Alright, so let's go over how to implement it. It's pretty easy. First, create a new class and inherit the packet structure class (like so):
Just by doing this, you've successfully implemented all of the methods from the Packet Structure class. You can now send your class as a byte array at any time. For example, if your character's send method accepts byte arrays, you don't need to do anything to send the packet as a byte array. My class does that implicitly (automatically). It will convert it to a byte array for you. If you wish to change the build method (maybe add some string building calls before finally building the packet), you can always override it by overriding the Build method.
Let's talk about constructing packets. You have two options. You can create your own to send to the client, or receive a packet from the client. Reading and Writing values is easy as well. I've supplied you with a variety of methods. I also gave my Write methods different names (on request) so you can easily see the type of value being written. Feel free to explore the class. I haven't tested it at all, so if you find an error, let me know.
Finally, here are a few examples of it in use:
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...] (Incomplete, just an example)
There are other things you can do as well. I hope this is what you guys asked for.
Cheers,
Spirited Fang.
This was a request by a few friends of mine to make a simple, managed packet writer for C#. You can use it to create packets of all different styles. Using it is easy as well. I'll give you all a few examples of what it can do and how to use it in a minute. First, here's the download for the source code. You may also choose to download it in the form of a dll (which is available through my mediafire account).
Source Download: [Only registered and activated users can see links. Click Here To Register...]
Alright, so let's go over how to implement it. It's pretty easy. First, create a new class and inherit the packet structure class (like so):
PHP Code:
// This is an example of a packet:
public class PacketName : PacketStructure
{
public PacketName(byte[] receivedPacket)
: base(receivedPacket)
{
}
}
Let's talk about constructing packets. You have two options. You can create your own to send to the client, or receive a packet from the client. Reading and Writing values is easy as well. I've supplied you with a variety of methods. I also gave my Write methods different names (on request) so you can easily see the type of value being written. Feel free to explore the class. I haven't tested it at all, so if you find an error, let me know.
Finally, here are a few examples of it in use:
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...] (Incomplete, just an example)
There are other things you can do as well. I hope this is what you guys asked for.
Cheers,
Spirited Fang.