Jump to content

[SOLVED] AutoIt Binary funcs into C#


Colduction
 Share

Recommended Posts

Hello. You can use power of C# byte[] functions.

 

Like: 

static void Main(string[] args)
        {

            var str = "Hello World";
            var bytes = Encoding.ASCII.GetBytes(str);

            string hexstr = BitConverter.ToString(bytes);
            Console.WriteLine(hexstr.Replace("-","") + " = " + Encoding.ASCII.GetString(bytes));
            Console.WriteLine("BinaryLen: " + (bytes.Length));
            Console.WriteLine("");

           //BinaryMid($dBinary, 1, 5)
            byte[] bytesMid = new byte[5];
            Array.Copy(bytes,0, bytesMid, 0, bytesMid.Length);
            hexstr = BitConverter.ToString(bytesMid);
            Console.WriteLine("BinaryMid(bytes, 1, 5)");
            Console.WriteLine(hexstr.Replace("-", "") +" = " + Encoding.ASCII.GetString(bytesMid));
            Console.WriteLine("BinaryLen: " + (bytesMid.Length));
            Console.WriteLine("");

            //BinaryMid($dBinary, 7, 5)
            bytesMid = new byte[5];
            Array.Copy(bytes, 6, bytesMid, 0, bytesMid.Length);
            hexstr = BitConverter.ToString(bytesMid);
            Console.WriteLine("BinaryMid(bytes, 7, 5)");
            Console.WriteLine(hexstr.Replace("-", "") + " = " + Encoding.ASCII.GetString(bytesMid));
            Console.WriteLine("BinaryLen: " + (bytesMid.Length));



            Console.ReadKey();
        }

 

Saludos

Link to comment
Share on other sites

  • Colduction changed the title to [SOLVED] AutoIt Binary funcs into C#

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...