Skip to content

Embedding

Thev2Andy edited this page Apr 1, 2022 · 1 revision

Get the DLL.

For this tutorial we'll embed the PowerBeep interpreter into a C# application.

First of all, you will need the PowerBeep DLL along with its dependencies, you can download them from the releases page.

DLL

Add the DLL as a dependency.

Next up, you need to add it as a dependency to your C# project file.

You can quickly slap this in your project file. (*.csproj)

<ItemGroup>
    <Reference Include="PowerBeep Interpreter">
      <HintPath>..\DLLs\PowerBeep\PowerBeep Interpreter.dll</HintPath>
    </Reference>
  </ItemGroup>

Implement the API.

The PowerBeep API is simple. You have an interpreter class for running code, obfuscator for turning code into hexadecimals, and a compiler for generating the resource files.

For this example, we're gonna write a small program that runs hardcoded PowerBeep code.

static void Main(string[] args)
{
    string Code = "BEEP 3" + Environment.NewLine + "WAIT 1650" + Environment.NewLine + "BEEP 1";
    Interpreter.Interpret(Code);

    while (true) ;
}

Now you can run PowerExec code programmatically.

Clone this wiki locally