internal static IDxfCodePairReader GetCodePairReader(string firstLine, int readBytes, BinaryReader binaryReader, Encoding defaultTextEncoding) { if (firstLine == DxbReader.BinarySentinel) { throw new DxfReadException("DXB files don't support code pairs. This path should never be hit.", readBytes); } else { Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); IDxfCodePairReader dxfReader; if (firstLine == BinarySentinel) { // swallow next two bytes var sub = binaryReader.ReadByte(); Debug.Assert(sub == 0x1A); var nul = binaryReader.ReadByte(); Debug.Assert(nul == 0x00); dxfReader = new DxfBinaryReader(binaryReader, readBytes + 2); } else { dxfReader = new DxfTextReader(binaryReader.BaseStream, defaultTextEncoding, firstLine); } return(dxfReader); } }
internal static IDxfCodePairReader GetCodePairReader(string firstLine, int readBytes, BinaryReader binaryReader, Encoding defaultTextEncoding) { if (firstLine == DxbReader.BinarySentinel) { throw new DxfReadException("DXB files don't support code pairs. This path should never be hit.", readBytes); } else { IDxfCodePairReader dxfReader; if (firstLine == BinarySentinel) { dxfReader = new DxfBinaryReader(binaryReader, readBytes); } else { dxfReader = new DxfTextReader(binaryReader.BaseStream, defaultTextEncoding, firstLine); } return(dxfReader); } }