/// <summary> /// Converts encoding ID to TextEncoding /// </summary> /// <param name="id">The identifier.</param> /// <returns>the encoding for this encoding ID</returns> public static Encoding AsEncoding(this EncodingIDs id) { switch (id) { case EncodingIDs.Unicode11: case EncodingIDs.Unicode2: return(Encoding.BigEndianUnicode); default: return(Encoding.UTF8); } }
public static NameRecord Read(BigEndianBinaryReader reader) { PlatformIDs platform = reader.ReadUInt16 <PlatformIDs>(); EncodingIDs encodingId = reader.ReadUInt16 <EncodingIDs>(); Encoding encoding = encodingId.AsEncoding(); ushort languageID = reader.ReadUInt16(); NameIds nameID = reader.ReadUInt16 <NameIds>(); var stringReader = StringLoader.Create(reader, encoding); return(new NameRecord(platform, languageID, nameID, string.Empty) { StringReader = stringReader }); }
public static NameRecord Read(BinaryReader reader) { var platform = reader.ReadUInt16 <PlatformIDs>(); EncodingIDs encodingId = reader.ReadUInt16 <EncodingIDs>(); Encoding encoding = encodingId.AsEncoding(); var languageID = reader.ReadUInt16(); var nameID = reader.ReadUInt16 <NameIds>(); var stringReader = StringLoader.Create(reader, encoding); return(new NameRecord(platform, languageID, nameID, null) { StringReader = stringReader }); }