public static void Align(this BinaryWriter writer, int alignBy, string name) { long offset = writer.BaseStream.Position; long mod = offset % alignBy; if (mod != 0) { writer.Write(new byte[alignBy - mod]); NMSTemplate.DebugLogTemplate($"[C] aligned {name} to offset 0x{writer.BaseStream.Position:X}"); } }