ArmConverter 1.0.0

Install-Package ArmConverter -Version 1.0.0
dotnet add package ArmConverter --version 1.0.0
<PackageReference Include="ArmConverter" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ArmConverter --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: ArmConverter, 1.0.0"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install ArmConverter as a Cake Addin
#addin nuget:?package=ArmConverter&version=1.0.0

// Install ArmConverter as a Cake Tool
#tool nuget:?package=ArmConverter&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

ArmConverter.Net

A relatively small C# .NET class library to communicate with https://armconverter.com

Instructions

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>

Examples

Single line of assembly code

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);
        }
    }
}

Multiple lines of assembly code

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));
        }
    }
}

Single element of hex code

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);
        }
    }
}

Multiple elements of hex code

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));
        }
    }
}
Notes

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 ()

Exceptions

System.FormatException

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

System.Net.WebException

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

TODO

  • 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
  • net5.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.0 233 5/2/2021

- Add working asynchronous methods
     - Miscellaneous code and documentation cleanup