A relatively small C# .NET class library to communicate with https://armconverter.com
Since the package has now been published on NuGet, you can now add the package to your *.csproj
file like so
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5.0</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="ArmConverter" Version="1.0.0" />
</ItemGroup>
</Project>
using System;
// Include library namespace
using ArmConverter;
namespace Example {
class Program {
static void Main (string[] args) {
// By default the 'archSelection' variable is set to AArch64 and the 'offset' variable is 0 when null so we only need to satisfy the first argument
string hex = Assembler.Assemble ("mov w0, #0");
// Printing the result to the console (with a newline obviously)
Console.WriteLine (hex);
}
}
}
using System;
// Include library namespace
using ArmConverter;
namespace Example {
class Program {
static void Main (string[] args) {
// Putting lines of assembly code into the array (thanks to 3096 for this part of their code patch used)
string[] assembly = { "mov w0, #0", "ret", "ldr w3, [x1]", "and w3, w3, #0xff", "cmp w3, #0x61", "b.ne #0x1c", "adr x1, #0x24", "sub sp, sp, #0x60", "b #0xfffffffffffcbff4" };
// By default the 'archSelection' variable is set to AArch64 and the 'offset' variable is 0 when null so we only need to satisfy the first argument
string[] hex = Assembler.MultiAssemble (assembly);
// Printing the results to the console seperated by newlines
Console.WriteLine (string.Join ('\n', hex));
}
}
}
using System;
// Include library namespace
using ArmConverter;
namespace Example {
class Program {
static void Main (string[] args) {
// By default the 'archSelection' variable is set to AArch64 and the 'offset' variable is 0 when null so we only need to satisfy the first argument
string assembly = Disassembler.Disassemble ("00008052");
// Printing the result to the console (with a newline obviously)
Console.WriteLine (assembly);
}
}
}
using System;
// Include library namespace
using ArmConverter;
namespace Example {
class Program {
static void Main (string[] args) {
// Putting elements of hex code into the array (thanks to 3096 for this part of their code patch used)
string[] hex = { "00008052", "C0035FD6", "230040B9", "631C0012", "7F840171", "E1000054", "21010010", "FF8301D1", "FD2FFF17" };
// By default the 'archSelection' variable is set to AArch64 and the 'offset' variable is 0 when null so we only need to satisfy the first argument
string[] assembly = Disassembler.MultiDisassemble (hex);
// Printing the results to the console seperated by newlines
Console.WriteLine (string.Join ('\n', assembly));
}
}
}
If you need multiple lines of hex code at one address, using the System.Linq
namespace, it can be printed to the console as follows
Console.WriteLine (string.Concat (result.AsEnumerable ()));
The variable result being the output of Assembler.MultiAssemble ()
Only thrown when an error occurs while attempting to assemble, the exception message being the one that the API returns, which depends on the error with the assembly code
Only thrown when an error occurs while attempting to disassemble, the exception message will most likely be The remote server returned an error: (400) Bad Request, due to the invalid hex code
- Different architectures
- Offset selection
- Assembling/disassembling of arrays
- Handling all known exceptions from the API
- Asynchronous copies of the methods
- XML documentation for all of the
public
methods - Add support for big-endian byte order
- Release the package on NuGet