Colduction Posted May 23, 2021 Posted May 23, 2021 Hi AutoIt Programmers, i wanna figure out how to use Binary functions in C# like:BinaryMid BinaryLen IsBinary and other basic ones were too ez, but those two were hard to noob like me. I appreciate for your helps/hints.
Danyfirex Posted May 23, 2021 Posted May 23, 2021 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 Colduction 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
Colduction Posted May 24, 2021 Author Posted May 24, 2021 4 hours ago, JockoDundee said: ...into C# ? Yes, if you don't mind
Colduction Posted May 24, 2021 Author Posted May 24, 2021 @Danyfirex thanks for coding this snippet, i appreciate!
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now