How to use the bytebuffer.METRICS_BYTES function in bytebuffer

To help you get started, we’ve selected a few bytebuffer examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github saul / demofile / dist / demo.js View on Github external
function parseHeader(buffer) {
    const bytebuf = ByteBuffer.wrap(buffer, true);
    return {
        magic: bytebuf.readString(8, ByteBuffer.METRICS_BYTES).split("\0", 2)[0],
        protocol: bytebuf.readInt32(),
        networkProtocol: bytebuf.readInt32(),
        serverName: bytebuf
            .readString(consts_1.MAX_OSPATH, ByteBuffer.METRICS_BYTES)
            .split("\0", 2)[0],
        clientName: bytebuf
            .readString(consts_1.MAX_OSPATH, ByteBuffer.METRICS_BYTES)
            .split("\0", 2)[0],
        mapName: bytebuf
            .readString(consts_1.MAX_OSPATH, ByteBuffer.METRICS_BYTES)
            .split("\0", 2)[0],
        gameDirectory: bytebuf
            .readString(consts_1.MAX_OSPATH, ByteBuffer.METRICS_BYTES)
            .split("\0", 2)[0],
        playbackTime: bytebuf.readFloat(),
        playbackTicks: bytebuf.readInt32(),
github saul / demofile / src / demo.ts View on Github external
export function parseHeader(buffer: Buffer): IDemoHeader {
  const bytebuf = ByteBuffer.wrap(buffer, true);
  return {
    magic: bytebuf.readString(8, ByteBuffer.METRICS_BYTES).split("\0", 2)[0],
    protocol: bytebuf.readInt32(),
    networkProtocol: bytebuf.readInt32(),
    serverName: bytebuf
      .readString(MAX_OSPATH, ByteBuffer.METRICS_BYTES)
      .split("\0", 2)[0],
    clientName: bytebuf
      .readString(MAX_OSPATH, ByteBuffer.METRICS_BYTES)
      .split("\0", 2)[0],
    mapName: bytebuf
      .readString(MAX_OSPATH, ByteBuffer.METRICS_BYTES)
      .split("\0", 2)[0],
    gameDirectory: bytebuf
      .readString(MAX_OSPATH, ByteBuffer.METRICS_BYTES)
      .split("\0", 2)[0],
    playbackTime: bytebuf.readFloat(),
    playbackTicks: bytebuf.readInt32(),
    playbackFrames: bytebuf.readInt32(),
    signonLength: bytebuf.readInt32()
  };
}
github saul / demofile / src / demo.ts View on Github external
export function parseHeader(buffer: Buffer): IDemoHeader {
  const bytebuf = ByteBuffer.wrap(buffer, true);
  return {
    magic: bytebuf.readString(8, ByteBuffer.METRICS_BYTES).split("\0", 2)[0],
    protocol: bytebuf.readInt32(),
    networkProtocol: bytebuf.readInt32(),
    serverName: bytebuf
      .readString(MAX_OSPATH, ByteBuffer.METRICS_BYTES)
      .split("\0", 2)[0],
    clientName: bytebuf
      .readString(MAX_OSPATH, ByteBuffer.METRICS_BYTES)
      .split("\0", 2)[0],
    mapName: bytebuf
      .readString(MAX_OSPATH, ByteBuffer.METRICS_BYTES)
      .split("\0", 2)[0],
    gameDirectory: bytebuf
      .readString(MAX_OSPATH, ByteBuffer.METRICS_BYTES)
      .split("\0", 2)[0],
    playbackTime: bytebuf.readFloat(),
    playbackTicks: bytebuf.readInt32(),
github saul / demofile / dist / demo.js View on Github external
function parseHeader(buffer) {
    const bytebuf = ByteBuffer.wrap(buffer, true);
    return {
        magic: bytebuf.readString(8, ByteBuffer.METRICS_BYTES).split("\0", 2)[0],
        protocol: bytebuf.readInt32(),
        networkProtocol: bytebuf.readInt32(),
        serverName: bytebuf
            .readString(consts_1.MAX_OSPATH, ByteBuffer.METRICS_BYTES)
            .split("\0", 2)[0],
        clientName: bytebuf
            .readString(consts_1.MAX_OSPATH, ByteBuffer.METRICS_BYTES)
            .split("\0", 2)[0],
        mapName: bytebuf
            .readString(consts_1.MAX_OSPATH, ByteBuffer.METRICS_BYTES)
            .split("\0", 2)[0],
        gameDirectory: bytebuf
            .readString(consts_1.MAX_OSPATH, ByteBuffer.METRICS_BYTES)
            .split("\0", 2)[0],
        playbackTime: bytebuf.readFloat(),
        playbackTicks: bytebuf.readInt32(),
        playbackFrames: bytebuf.readInt32(),
        signonLength: bytebuf.readInt32()
    };
}
exports.parseHeader = parseHeader;
github saul / demofile / dist / stringtables.js View on Github external
const bytebuf = ByteBuffer.wrap(buf, ByteBuffer.BIG_ENDIAN);
    bytebuf.skip(8);
    const hi = bytebuf.readUint32();
    const lo = bytebuf.readUint32();
    const xuid = Long.fromBits(lo, hi);
    const name = bytebuf
        .readString(consts_1.MAX_PLAYER_NAME_LENGTH, ByteBuffer.METRICS_BYTES)
        .split("\0", 2)[0];
    const userId = bytebuf.readUint32();
    const guid = bytebuf
        .readString(consts_1.SIGNED_GUID_LEN + 1, ByteBuffer.METRICS_BYTES)
        .split("\0", 2)[0];
    bytebuf.skip(3);
    const friendsId = bytebuf.readUint32();
    const friendsName = bytebuf
        .readString(consts_1.MAX_PLAYER_NAME_LENGTH, ByteBuffer.METRICS_BYTES)
        .split("\0", 2)[0];
    const fakePlayer = bytebuf.readByte() !== 0;
    bytebuf.skip(3);
    const isHltv = bytebuf.readByte() !== 0;
    bytebuf.skip(3);
    return {
        xuid,
        name,
        userId,
        guid,
        friendsId,
        friendsName,
        fakePlayer,
        isHltv
    };
}
github saul / demofile / dist / stringtables.js View on Github external
function parseUserInfoData(buf) {
    const bytebuf = ByteBuffer.wrap(buf, ByteBuffer.BIG_ENDIAN);
    bytebuf.skip(8);
    const hi = bytebuf.readUint32();
    const lo = bytebuf.readUint32();
    const xuid = Long.fromBits(lo, hi);
    const name = bytebuf
        .readString(consts_1.MAX_PLAYER_NAME_LENGTH, ByteBuffer.METRICS_BYTES)
        .split("\0", 2)[0];
    const userId = bytebuf.readUint32();
    const guid = bytebuf
        .readString(consts_1.SIGNED_GUID_LEN + 1, ByteBuffer.METRICS_BYTES)
        .split("\0", 2)[0];
    bytebuf.skip(3);
    const friendsId = bytebuf.readUint32();
    const friendsName = bytebuf
        .readString(consts_1.MAX_PLAYER_NAME_LENGTH, ByteBuffer.METRICS_BYTES)
        .split("\0", 2)[0];
    const fakePlayer = bytebuf.readByte() !== 0;
    bytebuf.skip(3);
    const isHltv = bytebuf.readByte() !== 0;
    bytebuf.skip(3);
    return {
        xuid,
github saul / demofile / src / stringtables.ts View on Github external
function parseUserInfoData(buf: Buffer): IPlayerInfo {
  const bytebuf = ByteBuffer.wrap(buf, ByteBuffer.BIG_ENDIAN);
  bytebuf.skip(8);

  const hi = bytebuf.readUint32();
  const lo = bytebuf.readUint32();

  const xuid = Long.fromBits(lo, hi);
  const name = bytebuf
    .readString(MAX_PLAYER_NAME_LENGTH, ByteBuffer.METRICS_BYTES)
    .split("\0", 2)[0];
  const userId = bytebuf.readUint32();
  const guid = bytebuf
    .readString(SIGNED_GUID_LEN + 1, ByteBuffer.METRICS_BYTES)
    .split("\0", 2)[0];
  bytebuf.skip(3);
  const friendsId = bytebuf.readUint32();
  const friendsName = bytebuf
    .readString(MAX_PLAYER_NAME_LENGTH, ByteBuffer.METRICS_BYTES)
    .split("\0", 2)[0];
  const fakePlayer = bytebuf.readByte() !== 0;
  bytebuf.skip(3);
  const isHltv = bytebuf.readByte() !== 0;
  bytebuf.skip(3);

  return {
    xuid,
    name,
    userId,
    guid,
github saul / demofile / src / stringtables.ts View on Github external
function parseUserInfoData(buf: Buffer): IPlayerInfo {
  const bytebuf = ByteBuffer.wrap(buf, ByteBuffer.BIG_ENDIAN);
  bytebuf.skip(8);

  const hi = bytebuf.readUint32();
  const lo = bytebuf.readUint32();

  const xuid = Long.fromBits(lo, hi);
  const name = bytebuf
    .readString(MAX_PLAYER_NAME_LENGTH, ByteBuffer.METRICS_BYTES)
    .split("\0", 2)[0];
  const userId = bytebuf.readUint32();
  const guid = bytebuf
    .readString(SIGNED_GUID_LEN + 1, ByteBuffer.METRICS_BYTES)
    .split("\0", 2)[0];
  bytebuf.skip(3);
  const friendsId = bytebuf.readUint32();
  const friendsName = bytebuf
    .readString(MAX_PLAYER_NAME_LENGTH, ByteBuffer.METRICS_BYTES)
    .split("\0", 2)[0];
  const fakePlayer = bytebuf.readByte() !== 0;
  bytebuf.skip(3);
  const isHltv = bytebuf.readByte() !== 0;
  bytebuf.skip(3);

  return {