Skip to content

Instantly share code, notes, and snippets.

View z16's full-sized avatar
💭
(let ((let '`(let ((let ',let)), let))) `(let ((let ',let)) ,let))

Stjepan Bakrac z16

💭
(let ((let '`(let ((let ',let)), let))) `(let ((let ',let)) ,let))
  • Munich, Germany
View GitHub Profile
@z16
z16 / Program.cs
Created March 25, 2022 00:30
Example Windower IPC implementation in C#. To use, load the `Eval` addon and simply register the IPC event with `//eval windower.register_event('ipc message', print)`.
using System;
using System.Diagnostics;
using System.IO.MemoryMappedFiles;
using System.Linq;
using System.Text;
using System.Threading;
using static System.Console;
namespace WindowerIpc;
public unsafe class Ipc {
public Ipc(String addon) {
AddonBytes = Encoding.UTF8.GetBytes(addon);
if (AddonBytes.Length >= AddonSize) {
throw new InvalidDataException("Maximum length for addon name is 31 bytes in UTF-8.");
}
}
public void Send(String message, String character) =>
Send(message, GetPid(character));