/// <summary> /// Reads a name entry's header and payload from the given binary /// WebAssembly reader. /// </summary> /// <param name="Reader">The reader to read the name entry from.</param> /// <returns>A name entry.</returns> public static NameEntry Read(BinaryWasmReader Reader) { NameEntryKind kind = (NameEntryKind)Reader.ReadVarUInt7(); uint length = Reader.ReadVarUInt32(); switch (kind) { case NameEntryKind.Module: return(ModuleNameEntry.ReadPayload(Reader, length)); default: return(UnknownNameEntry.ReadPayload(Reader, kind, length)); } }
/// <summary> /// Reads an unknown name entry's payload. /// </summary> /// <param name="Reader">The reader to read the name entry payload from.</param> /// <param name="Kind">The kind of name entry to read.</param> /// <param name="Length">The length of the name entry's payload, in bytes.</param> /// <returns>An unknown name entry.</returns> public static UnknownNameEntry ReadPayload(BinaryWasmReader Reader, NameEntryKind Kind, uint Length) { return(new UnknownNameEntry(Kind, Reader.ReadBytes((int)Length))); }
/// <summary> /// Creates an unknown name entry from the given entry kind and payload. /// </summary> public UnknownNameEntry(NameEntryKind Kind, byte[] Payload) { this.entryKind = Kind; this.Payload = Payload; }
/// <summary> /// Reads an unknown name entry's payload. /// </summary> /// <param name="reader">The reader to read the name entry payload from.</param> /// <param name="kind">The kind of name entry to read.</param> /// <param name="length">The length of the name entry's payload, in bytes.</param> /// <returns>An unknown name entry.</returns> public static UnknownNameEntry ReadPayload(BinaryWasmReader reader, NameEntryKind kind, uint length) { return(new UnknownNameEntry(kind, reader.ReadBytes((int)length))); }
/// <summary> /// Creates an unknown name entry from the given entry kind and payload. /// </summary> public UnknownNameEntry(NameEntryKind kind, byte[] payload) { this.entryKind = kind; this.Payload = payload; }