Needing a little push

09/09/2012 10:58 iNiperx#1
Hei, i just got somewhat interest on making a little bot or w.e just for fun, im using vb.net and using the C# SilkroadSecurity and i can log in and all that but could someone give me a little example how to send any packet? example "sit"
i get:

Code:
[S -> C] [30BF]
8D 65 03 00
01
04
also i need a little help putting this:

Code:
Console.WriteLine("[{0}][{1:X4}][{2} bytes]{3}{4}{6}{5}{6}", If(context.Equals(local_context), "S->C", "C->S"), packet.Opcode, packet_bytes.Length, If(packet.Encrypted, "[Encrypted]", ""), If(packet.Massive, "[Massive]", ""), Utility.HexDump(packet_bytes), Environment.NewLine)
to textbox instead of console
09/09/2012 16:57 DaxterSoul#2
Code:
textbox1.Text = string.Format("[{0}][{1:X4}][{2} bytes]{3}{4}{6}{5}{6}", If(context.Equals(local_context), "S->C", "C->S"), packet.Opcode, packet_bytes.Length, If(packet.Encrypted, "[Encrypted]", ""), If(packet.Massive, "[Massive]", ""), Utility.HexDump(packet_bytes), Environment.NewLine);
09/10/2012 10:21 ZeraPain#3
Packet tmp = new Packet(0x30BF, false)
tmp.writeuint32(world_id)
tmp.writeuint8(1)
tmp.writeuint8(4)

after that you can add the tmp packet to the buffer
09/10/2012 17:59 lesderid#4
Quote:
Originally Posted by iNiperx View Post
also i need a little help putting this:

Code:
Console.WriteLine("[{0}][{1:X4}][{2} bytes]{3}{4}{6}{5}{6}", If(context.Equals(local_context), "S->C", "C->S"), packet.Opcode, packet_bytes.Length, If(packet.Encrypted, "[Encrypted]", ""), If(packet.Massive, "[Massive]", ""), Utility.HexDump(packet_bytes), Environment.NewLine)
to textbox instead of console
WinForms or WPF?
09/12/2012 02:03 iNiperx#5
WinForm, and some guys told me to use C# instead, so should i ? or its the same ?
09/12/2012 11:15 ZeraPain#6
well you will have to create a method in your form.cs which allows you to modify the textbox (you will have to use a methodinvoker).
then you can call this function from your thread and display the packet in the textbox.
09/12/2012 16:49 cyberninjah#7
Code:
        public delegate void dUpdateLogs(string log);
        public dUpdateLogs UpdateLogs;

UpdateLogs = new dUpdateLogs(DoUpdateLogs);

        void DoUpdateLogs(string log)
        {
            string currentTime = "[" + DateTime.Now.ToLongTimeString() + "] ";

            if (logconsole.Dispatcher.CheckAccess())
            {
                logconsole.AppendText(currentTime + log + " \r");
                logconsole.ScrollToEnd();
            }
            else
            {
                // Invokation required
                logconsole.Dispatcher.Invoke(DispatcherPriority.Normal, new dUpdateLogs(DoUpdateLogs), log);
            }
        }
I used this in my old projects maybe it can help you.
09/15/2012 03:51 sarkoplata#8
Screw all the damn invoking methods, just use this:
Code:
Add to form_load:
Control.CheckForIllegalCrossThreadCalls = False
Me.CheckForIllegalCrossThreadCalls = False
Declare your form1 to use outside:
Code:
Public Shared GUI As New Form1
To change your gui from another thread, use it like this:
Code:
Main.GUI.TextBox1.Text = "aaaaaaa"
09/15/2012 06:59 supermando#9
Code:
        private void WriteLog(string text)
        {
            if (logbox.InvokeRequired)
            {
                logbox.Invoke(new MethodInvoker(() => logbox.Items.Add("[" + DateTime.Now.ToLongTimeString() + "] " + text)));
                logbox.Invoke(new MethodInvoker(() => logbox.TopIndex = logbox.Items.Count - 1));
            }
            else
            {
                logbox.Items.Add("[" + DateTime.Now.ToLongTimeString() + "] " + text);
                logbox.TopIndex = logbox.Items.Count - 1;
            }
        }
09/15/2012 08:12 iNiperx#10
Thx guys i got it :)
Soon i'll try to send packets