ArmConverter 1.0.0

dotnet add package ArmConverter --version 1.0.0
NuGet\Install-Package ArmConverter -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<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
#r "nuget: ArmConverter, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. 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

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
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • 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 546 5/2/2021

- Add working asynchronous methods
     - Miscellaneous code and documentation cleanup