Register for your free account! | Forgot your password?

You last visited: Today at 11:58

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[Release] Simple Packet Writer

Discussion on [Release] Simple Packet Writer within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old 11/17/2012, 00:20   #16
 
Danial Eugen's Avatar
 
elite*gold: 0
Join Date: Sep 2012
Posts: 171
Received Thanks: 68
Quote:
Originally Posted by Fаng View Post
Well, I disagree with this method of writing packets. I use structs and pointers to write and handle my packets. If you like this style of writing packets though (I have to admit, it makes the concept a lot easier to understand at first), then there's no problem with that.

Answering your question though, things that can be improved... There's a lot. You could manage the memory instead of using a managed byte array (however, that's too much for something like this). I would just leave it as it is really. You could add a few methods here and there if you'd like. Make better get hash and string methods and such. It's really up to you. Here's a method you can add if you'd like (as an example):

Code:
using System.Drawing;
Code:
        /// <summary> This method returns a color from the packet at the specified offset. </summary>
        /// <param name="offset">The position at which the reader will read from.</param>
        /// <returns>The color read from the packet at the specified offset.</returns>
        public Color ReadColor(int offset)
        {
            // Error check the length:
            if (offset + 4 > _array.Length)
                throw new IndexOutOfRangeException("Attempted to read out of the bounds of the packet array.");

            // Read the value:
            fixed (byte* ptr = _array)
                return *(Color*)(ptr + offset);
        }
Code:
        /// <summary> This method writes a color to the packet structure. </summary>
        /// <param name="value">The value being written to the packet.</param>
        /// <param name="offset">The position where the value will be written to.</param>
        public void WriteColor(Color value, int offset)
        {
            // Error check the length:
            if (offset + 4 > _array.Length)
                throw new IndexOutOfRangeException("Attempted to write out of the bounds of the packet array.");

            // Write the value:
            fixed (byte* ptr = _array)
                *(Color*)(ptr + offset) = value;
        }
Well this is very nice. I just like the way the class is written it is very clear, well handled, also i like that style of writing packets.

But can't you use a pointer to non unmanaged types ?! cuz Color is managed System.Drawing.
Danial Eugen is offline  
Old 11/17/2012, 02:23   #17
 
Spirited's Avatar
 
elite*gold: 12
Join Date: Jul 2011
Posts: 8,211
Received Thanks: 4,114
Quote:
Originally Posted by Danial Eugen View Post
Well this is very nice. I just like the way the class is written it is very clear, well handled, also i like that style of writing packets.

But can't you use a pointer to non unmanaged types ?! cuz Color is managed System.Drawing.
Any struct that doesn't contain managed classes can be a pointer. Color is just a struct (containing four bytes for the ARGB color code) with a list of constants and a few methods.
Spirited is offline  
Reply


Similar Threads Similar Threads
[Release]Flyff D3D Writer
03/23/2012 - Flyff PServer Guides & Releases - 11 Replies
Ich release hier mal einen D3D Writer für Flyff er tut nix anderes als einen Text in Flyff in gewünschter höhe, breite und größe zu rendern. Wer sich fragt wofür? Mann kan es einfach nutzen um Videos Diebstahl sicher zu machen vor leuten die es für seine ausgeben oder Auf screens hinweise hinschreiben ohne großen aufwand. VT: 2/43 DIESE SIND KEINE BACKDOORS ES SIND DIE D3D dll's Klick
Hmm packet writer question.
09/21/2011 - CO2 Private Server - 11 Replies
Why do everybody uses something like. WriteByte(byte value); WriteUInt32(uint value); //.... When you could just do something like. public unsafe class ConquerPacket
[RELEASE]API Tool Writer 1.0
07/20/2011 - Metin2 Hacks, Bots, Cheats, Exploits & Macros - 11 Replies
Heyho liebe e*pvper. Ich wollte heute mal mein kleines Tool für das Api Tool veröffentlichen. Ich selbst benutze es schon länger, wollte es aber mal Public machen, da es doch viel schneller ist, als wenn man per Hand schreiben würde (hilfreich wenn man z.B. schnell die GM Rechte ausschalten möchte). Die Version 1.0 enthält nur alle wichtigen "Befehle". http://img233.imageshack.us/img233/4369/writer12. jpg &#x202a;API Tool Writer&#x202c;&rlm; - YouTube Virusscan
Simple Packet based Shaiyabot Beta
05/19/2010 - Shaiya Hacks, Bots, Cheats & Exploits - 0 Replies
removed
Simple packet bot/app/tool?
01/28/2009 - Silkroad Online - 0 Replies
I have minimal-basic programming experience, what i am wanting to do is set up a char (preferably clientless) that searched the stall network (weapons 9 degrees) for items suitable to rondo (eg if 85 + Blue and price < 5.6m then buy) How would i go about doing this? I presume i would need to do something with edx33/sr33? Is that even plausible or possible? Or is there another way to do this?



All times are GMT +2. The time now is 11:58.


Powered by vBulletin®
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2024 elitepvpers All Rights Reserved.