private static void WriteEncodeBody(BinaryReader br, BinaryWriter bw, PsbStreamContext context, PsbHeader header) { bw.Write ( context.Encode ( br.ReadBytes((int)(header.OffsetChunkOffsets - header.OffsetNames)) ) ); WriteToEnd(br, bw); }
/// <summary> /// Encode a value and write using <see cref="BinaryWriter"/>. /// </summary> /// <param name="context"></param> /// <param name="value"></param> /// <param name="bw"></param> public static void Write(this PsbStreamContext context, ushort value, BinaryWriter bw) { bw.Write(context.Encode(BitConverter.GetBytes(value))); }
/// <summary> /// Read a <see cref="ushort"/> from <see cref="BinaryReader"/>, and then encode using <see cref="PsbStreamContext"/>. /// </summary> /// <param name="context"></param> /// <param name="br"></param> /// <returns></returns> public static ushort ReadUInt16(this PsbStreamContext context, BinaryReader br) { return(BitConverter.ToUInt16(context.Encode(br.ReadBytes(2)), 0)); }
/// <summary> /// Read bytes from <see cref="BinaryReader"/>, and then encode using <see cref="PsbStreamContext"/>. /// </summary> /// <param name="context"></param> /// <param name="br"></param> /// <param name="count"></param> /// <returns></returns> public static byte[] ReadBytes(this PsbStreamContext context, BinaryReader br, int count) { return(context.Encode(br.ReadBytes(count))); }