本文整理汇总了C#中System.Text.DecoderNLS类的典型用法代码示例。如果您正苦于以下问题:C# DecoderNLS类的具体用法?C# DecoderNLS怎么用?C# DecoderNLS使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DecoderNLS类属于System.Text命名空间,在下文中一共展示了DecoderNLS类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: EncodingCharBuffer
[System.Security.SecurityCritical] // auto-generated
internal unsafe EncodingCharBuffer(EncodingNLS enc, DecoderNLS decoder, char* charStart, int charCount, byte* byteStart, int byteCount)
{
_enc = enc;
_decoder = decoder;
_chars = charStart;
_charStart = charStart;
_charEnd = charStart + charCount;
_byteStart = byteStart;
_bytes = byteStart;
_byteEnd = byteStart + byteCount;
if (_decoder == null)
_fallbackBuffer = enc.DecoderFallback.CreateFallbackBuffer();
else
_fallbackBuffer = _decoder.FallbackBuffer;
// If we're getting chars or getting char count we don't expect to have
// to remember fallbacks between calls (so it should be empty)
Debug.Assert(_fallbackBuffer.Remaining == 0,
"[Encoding.EncodingCharBuffer.EncodingCharBuffer]Expected empty fallback buffer for getchars/charcount");
_fallbackBufferHelper = new DecoderFallbackBufferHelper(_fallbackBuffer);
_fallbackBufferHelper.InternalInitialize(_bytes, _charEnd);
}
示例2: GetCharCount
internal override unsafe int GetCharCount(byte* bytes, int count, DecoderNLS baseDecoder)
{
int num4;
byte* pSrc = bytes;
byte* a = pSrc + count;
int num = count;
int ch = 0;
DecoderFallbackBuffer fallback = null;
if (baseDecoder != null)
{
UTF8Decoder decoder = (UTF8Decoder) baseDecoder;
ch = decoder.bits;
num -= ch >> 30;
}
Label_0027:
if (pSrc >= a)
{
goto Label_0336;
}
if (ch == 0)
{
ch = pSrc[0];
pSrc++;
goto Label_010D;
}
int num3 = pSrc[0];
pSrc++;
if ((num3 & -64) != 0x80)
{
pSrc--;
num += ch >> 30;
}
else
{
ch = (ch << 6) | (num3 & 0x3f);
if ((ch & 0x20000000) == 0)
{
if ((ch & 0x10000000) != 0)
{
if (((ch & 0x800000) != 0) || InRange(ch & 0x1f0, 0x10, 0x100))
{
goto Label_0027;
}
}
else if (((ch & 0x3e0) != 0) && ((ch & 0x3e0) != 0x360))
{
goto Label_0027;
}
}
else
{
if ((ch & 0x101f0000) == 0x10000000)
{
num--;
}
goto Label_0183;
}
}
Label_00C9:
if (fallback == null)
{
if (baseDecoder == null)
{
fallback = base.decoderFallback.CreateFallbackBuffer();
}
else
{
fallback = baseDecoder.FallbackBuffer;
}
fallback.InternalInitialize(bytes, null);
}
num += this.FallbackInvalidByteSequence(pSrc, ch, fallback);
ch = 0;
goto Label_0027;
Label_010D:
if (ch > 0x7f)
{
num--;
if ((ch & 0x40) == 0)
{
goto Label_00C9;
}
if ((ch & 0x20) != 0)
{
if ((ch & 0x10) != 0)
{
ch &= 15;
if (ch > 4)
{
ch |= 240;
goto Label_00C9;
}
ch |= 0x504d0c00;
num--;
}
else
{
ch = (ch & 15) | 0x48228000;
num--;
}
//.........这里部分代码省略.........
示例3: GetCharCount
// Workhorse
internal override unsafe int GetCharCount(byte* bytes, int count, DecoderNLS baseDecoder)
{
// Just call GetChars with null chars saying we want count
return GetChars(bytes, count, null, 0, baseDecoder);
}
示例4: GetCharCount
[System.Security.SecurityCritical] // auto-generated
public override unsafe int GetCharCount(byte* bytes, int count, DecoderNLS baseDecoder)
{
// Just assert, we're called internally so these should be safe, checked already
Debug.Assert(bytes != null, "[DBCSCodePageEncoding.GetCharCount]bytes is null");
Debug.Assert(count >= 0, "[DBCSCodePageEncoding.GetCharCount]byteCount is negative");
CheckMemorySection();
// Fix our decoder
DBCSDecoder decoder = (DBCSDecoder)baseDecoder;
// Get our fallback
DecoderFallbackBuffer fallbackBuffer = null;
// We'll need to know where the end is
byte* byteEnd = bytes + count;
int charCount = count; // Assume 1 char / byte
// Shouldn't have anything in fallback buffer for GetCharCount
// (don't have to check m_throwOnOverflow for count)
Debug.Assert(decoder == null ||
!decoder.InternalHasFallbackBuffer || decoder.FallbackBuffer.Remaining == 0,
"[DBCSCodePageEncoding.GetCharCount]Expected empty fallback buffer at start");
DecoderFallbackBufferHelper fallbackHelper = new DecoderFallbackBufferHelper(fallbackBuffer);
// If we have a left over byte, use it
if (decoder != null && decoder.bLeftOver > 0)
{
// We have a left over byte?
if (count == 0)
{
// No input though
if (!decoder.MustFlush)
{
// Don't have to flush
return 0;
}
Debug.Assert(fallbackBuffer == null,
"[DBCSCodePageEncoding.GetCharCount]Expected empty fallback buffer");
fallbackBuffer = decoder.FallbackBuffer;
fallbackHelper = new DecoderFallbackBufferHelper(fallbackBuffer);
fallbackHelper.InternalInitialize(bytes, null);
byte[] byteBuffer = new byte[] { unchecked((byte)decoder.bLeftOver) };
return fallbackHelper.InternalFallback(byteBuffer, bytes);
}
// Get our full info
int iBytes = decoder.bLeftOver << 8;
iBytes |= (*bytes);
bytes++;
// This is either 1 known char or fallback
// Already counted 1 char
// Look up our bytes
char cDecoder = mapBytesToUnicode[iBytes];
if (cDecoder == 0 && iBytes != 0)
{
// Deallocate preallocated one
charCount--;
// We'll need a fallback
Debug.Assert(fallbackBuffer == null,
"[DBCSCodePageEncoding.GetCharCount]Expected empty fallback buffer for unknown pair");
fallbackBuffer = decoder.FallbackBuffer;
fallbackHelper = new DecoderFallbackBufferHelper(fallbackBuffer);
fallbackHelper.InternalInitialize(byteEnd - count, null);
// Do fallback, we know there are 2 bytes
byte[] byteBuffer = new byte[] { unchecked((byte)(iBytes >> 8)), unchecked((byte)iBytes) };
charCount += fallbackHelper.InternalFallback(byteBuffer, bytes);
}
// else we already reserved space for this one.
}
// Loop, watch out for fallbacks
while (bytes < byteEnd)
{
// Faster if don't use *bytes++;
int iBytes = *bytes;
bytes++;
char c = mapBytesToUnicode[iBytes];
// See if it was a double byte character
if (c == LEAD_BYTE_CHAR)
{
// It's a lead byte
charCount--; // deallocate preallocated lead byte
if (bytes < byteEnd)
{
// Have another to use, so use it
iBytes <<= 8;
iBytes |= *bytes;
bytes++;
c = mapBytesToUnicode[iBytes];
}
//.........这里部分代码省略.........
示例5: GetCharCount
internal override unsafe int GetCharCount(byte* bytes, int count, DecoderNLS baseDecoder)
{
UnicodeEncoding.Decoder decoder = (UnicodeEncoding.Decoder)baseDecoder;
byte* byteEnd = bytes + count;
byte* byteStart = bytes;
// Need last vars
int lastByte = -1;
char lastChar = (char)0;
// Start by assuming same # of chars as bytes
int charCount = count >> 1;
// Need -1 to check 2 at a time. If we have an even #, longBytes will go
// from longEnd - 1/2 long to longEnd + 1/2 long. If we're odd, longBytes
// will go from longEnd - 1 long to longEnd. (Might not get to use this)
ulong* longEnd = (ulong*)(byteEnd - 7);
// For fallback we may need a fallback buffer
DecoderFallbackBuffer fallbackBuffer = null;
if (decoder != null)
{
lastByte = decoder.lastByte;
lastChar = decoder.lastChar;
// Assume extra char if last char was around
if (lastChar > 0)
charCount++;
// Assume extra char if extra last byte makes up odd # of input bytes
if (lastByte >= 0 && (count & 1) == 1)
{
charCount++;
}
}
while (bytes < byteEnd)
{
// If we're aligned then maybe we can do it fast
// This'll hurt if we're unaligned because we'll always test but never be aligned
#if !NO_FAST_UNICODE_LOOP
#if BIGENDIAN
if (bigEndian &&
#else // BIGENDIAN
if (!bigEndian &&
#endif // BIGENDIAN
#if WIN64 // win64 has to be long aligned
(unchecked((long)bytes) & 7) == 0 &&
#else
(unchecked((int)bytes) & 3) == 0 &&
#endif // WIN64
lastByte == -1 && lastChar == 0)
{
// Need new char* so we can check 4 at a time
ulong* longBytes = (ulong*)bytes;
while (longBytes < longEnd)
{
// See if we potentially have surrogates (0x8000 bit set)
// (We're either big endian on a big endian machine or little endian on
// a little endian machine so this'll work)
if ((0x8000800080008000 & *longBytes) != 0)
{
// See if any of these are high or low surrogates (0xd800 - 0xdfff). If the high
// 5 bits looks like 11011, then its a high or low surrogate.
// We do the & f800 to filter the 5 bits, then ^ d800 to ensure the 0 isn't set.
// Note that we expect BMP characters to be more common than surrogates
// & each char with 11111... then ^ with 11011. Zeroes then indicate surrogates
ulong uTemp = (0xf800f800f800f800 & *longBytes) ^ 0xd800d800d800d800;
// Check each of the 4 chars. 0 for those 16 bits means it was a surrogate
// but no clue if they're high or low.
// If each of the 4 characters are non-zero, then none are surrogates.
if ((uTemp & 0xFFFF000000000000) == 0 ||
(uTemp & 0x0000FFFF00000000) == 0 ||
(uTemp & 0x00000000FFFF0000) == 0 ||
(uTemp & 0x000000000000FFFF) == 0)
{
// It has at least 1 surrogate, but we don't know if they're high or low surrogates,
// or if there's 1 or 4 surrogates
// If they happen to be high/low/high/low, we may as well continue. Check the next
// bit to see if its set (low) or not (high) in the right pattern
#if BIGENDIAN
if (((0xfc00fc00fc00fc00 & *longBytes) ^ 0xd800dc00d800dc00) != 0)
#else
if (((0xfc00fc00fc00fc00 & *longBytes) ^ 0xdc00d800dc00d800) != 0)
#endif
{
// Either there weren't 4 surrogates, or the 0x0400 bit was set when a high
// was hoped for or the 0x0400 bit wasn't set where a low was hoped for.
// Drop out to the slow loop to resolve the surrogates
break;
}
// else they are all surrogates in High/Low/High/Low order, so we can use them.
}
// else none are surrogates, so we can use them.
//.........这里部分代码省略.........
示例6: GetCharCount
[System.Security.SecurityCritical] // auto-generated
internal override unsafe int GetCharCount(byte* bytes, int count, DecoderNLS baseDecoder)
{
Contract.Assert(count >=0, "[UTF8Encoding.GetCharCount]count >=0");
Contract.Assert(bytes!=null, "[UTF8Encoding.GetCharCount]bytes!=null");
// Initialize stuff
byte *pSrc = bytes;
byte *pEnd = pSrc+count;
// Start by assuming we have as many as count, charCount always includes the adjustment
// for the character being decoded
int charCount = count;
int ch = 0;
DecoderFallbackBuffer fallback = null;
if (baseDecoder != null) {
UTF8Decoder decoder = (UTF8Decoder)baseDecoder;
ch = decoder.bits;
charCount -= (ch >> 30); // Adjust char count for # of expected bytes and expected output chars.
// Shouldn't have anything in fallback buffer for GetCharCount
// (don't have to check m_throwOnOverflow for count)
Contract.Assert(!decoder.InternalHasFallbackBuffer || decoder.FallbackBuffer.Remaining == 0,
"[UTF8Encoding.GetCharCount]Expected empty fallback buffer at start");
}
for (;;)
{
// SLOWLOOP: does all range checks, handles all special cases, but it is slow
if (pSrc >= pEnd) {
break;
}
if (ch == 0) {
// no pending bits
goto ReadChar;
}
// read next byte. The JIT optimization seems to be getting confused when
// compiling "ch = *pSrc++;", so rather use "ch = *pSrc; pSrc++;" instead
int cha = *pSrc;
pSrc++;
// we are expecting to see trailing bytes like 10vvvvvv
if ((cha & unchecked((sbyte)0xC0)) != 0x80) {
// This can be a valid starting byte for another UTF8 byte sequence, so let's put
// the current byte back, and try to see if this is a valid byte for another UTF8 byte sequence
pSrc--;
charCount += (ch >> 30);
goto InvalidByteSequence;
}
// fold in the new byte
ch = (ch << 6) | (cha & 0x3F);
if ((ch & FinalByte) == 0) {
Contract.Assert( (ch & (SupplimentarySeq | ThreeByteSeq)) != 0,
"[UTF8Encoding.GetChars]Invariant volation");
if ((ch & SupplimentarySeq) != 0) {
if ((ch & (FinalByte >> 6)) != 0) {
// this is 3rd byte (of 4 byte supplimentary) - nothing to do
continue;
}
// 2nd byte, check for non-shortest form of supplimentary char and the valid
// supplimentary characters in range 0x010000 - 0x10FFFF at the same time
if (!InRange(ch & 0x1F0, 0x10, 0x100)) {
goto InvalidByteSequence;
}
}
else {
// Must be 2nd byte of a 3-byte sequence
// check for non-shortest form of 3 byte seq
if ((ch & (0x1F << 5)) == 0 || // non-shortest form
(ch & (0xF800 >> 6) ) == (0xD800 >> 6)) // illegal individually encoded surrogate
{
goto InvalidByteSequence;
}
}
continue;
}
// ready to punch
// adjust for surrogates in non-shortest form
if ((ch & (SupplimentarySeq | 0x1F0000)) == SupplimentarySeq) {
charCount--;
}
goto EncodeChar;
InvalidByteSequence:
// this code fragment should be close to the gotos referencing it
// Have to do fallback for invalid bytes
if (fallback == null)
{
if (baseDecoder == null)
fallback = this.decoderFallback.CreateFallbackBuffer();
//.........这里部分代码省略.........
示例7: GetChars
internal virtual unsafe int GetChars(byte* bytes, int byteCount, char* chars, int charCount, DecoderNLS decoder)
{
return this.GetChars(bytes, byteCount, chars, charCount);
}
示例8: EncodingCharBuffer
internal unsafe EncodingCharBuffer(Encoding enc, DecoderNLS decoder, char* charStart, int charCount, byte* byteStart, int byteCount)
{
this.enc = enc;
this.decoder = decoder;
this.chars = charStart;
this.charStart = charStart;
this.charEnd = charStart + charCount;
this.byteStart = byteStart;
this.bytes = byteStart;
this.byteEnd = byteStart + byteCount;
if (this.decoder == null)
{
this.fallbackBuffer = enc.DecoderFallback.CreateFallbackBuffer();
}
else
{
this.fallbackBuffer = this.decoder.FallbackBuffer;
}
this.fallbackBuffer.InternalInitialize(this.bytes, this.charEnd);
}
示例9: GetCharCount
internal override unsafe int GetCharCount(byte* bytes, int count, DecoderNLS baseDecoder)
{
BCLDebug.Assert(bytes!=null, "[UTF32Encoding.GetCharCount]bytes!=null");
BCLDebug.Assert(count >=0, "[UTF32Encoding.GetCharCount]count >=0");
UTF32Decoder decoder = (UTF32Decoder)baseDecoder;
// None so far!
int charCount = 0;
byte* end = bytes + count;
byte* byteStart = bytes;
// Set up decoder
int readCount = 0;
uint iChar = 0;
// For fallback we may need a fallback buffer
DecoderFallbackBuffer fallbackBuffer = null;
// See if there's anything in our decoder
if (decoder != null)
{
readCount = decoder.readByteCount;
iChar = (uint)decoder.iChar;
fallbackBuffer = decoder.FallbackBuffer;
// Shouldn't have anything in fallback buffer for GetCharCount
// (don't have to check m_throwOnOverflow for chars or count)
BCLDebug.Assert(fallbackBuffer.Remaining == 0,
"[UTF32Encoding.GetCharCount]Expected empty fallback buffer at start");
}
else
{
fallbackBuffer = this.decoderFallback.CreateFallbackBuffer();
}
// Set our internal fallback interesting things.
fallbackBuffer.InternalInitialize(byteStart, null);
// Loop through our input, 4 characters at a time!
while (bytes < end && charCount >= 0)
{
// Get our next character
if(bigEndian)
{
// Scoot left and add it to the bottom
iChar <<= 8;
iChar += *(bytes++);
}
else
{
// Scoot right and add it to the top
iChar >>= 8;
iChar += (uint)(*(bytes++)) << 24;
}
readCount++;
// See if we have all the bytes yet
if (readCount < 4)
continue;
// Have the bytes
readCount = 0;
// See if its valid to encode
if ( iChar > 0x10FFFF || (iChar >= 0xD800 && iChar <= 0xDFFF))
{
// Need to fall back these 4 bytes
byte[] fallbackBytes;
if (this.bigEndian)
{
fallbackBytes = new byte[] {
unchecked((byte)(iChar>>24)), unchecked((byte)(iChar>>16)),
unchecked((byte)(iChar>>8)), unchecked((byte)(iChar)) };
}
else
{
fallbackBytes = new byte[] {
unchecked((byte)(iChar)), unchecked((byte)(iChar>>8)),
unchecked((byte)(iChar>>16)), unchecked((byte)(iChar>>24)) };
}
charCount += fallbackBuffer.InternalFallback(fallbackBytes, bytes);
// Ignore the illegal character
iChar = 0;
continue;
}
// Ok, we have something we can add to our output
if (iChar >= 0x10000)
{
// Surrogates take 2
charCount++;
}
// Add the rest of the surrogate or our normal character
charCount++;
//.........这里部分代码省略.........
示例10: GetChars
[System.Security.SecurityCritical] // auto-generated
internal override unsafe int GetChars(byte* bytes, int byteCount,
char* chars, int charCount, DecoderNLS baseDecoder)
{
Contract.Assert(byteCount >=0, "[UTF7Encoding.GetChars]byteCount >=0");
Contract.Assert(bytes!=null, "[UTF7Encoding.GetChars]bytes!=null");
Contract.Assert(charCount >=0, "[UTF7Encoding.GetChars]charCount >=0");
// Might use a decoder
UTF7Encoding.Decoder decoder = (UTF7Encoding.Decoder) baseDecoder;
// Get our output buffer info.
Encoding.EncodingCharBuffer buffer = new Encoding.EncodingCharBuffer(
this, decoder, chars, charCount, bytes, byteCount);
// Get decoder info
int bits = 0;
int bitCount = -1;
bool firstByte = false;
if (decoder != null)
{
bits = decoder.bits;
bitCount = decoder.bitCount;
firstByte = decoder.firstByte;
Contract.Assert(firstByte == false || decoder.bitCount <= 0,
"[UTF7Encoding.GetChars]If remembered bits, then first byte flag shouldn't be set");
}
// We may have had bits in the decoder that we couldn't output last time, so do so now
if (bitCount >= 16)
{
// Check our decoder buffer
if (!buffer.AddChar((char)((bits >> (bitCount - 16)) & 0xFFFF)))
ThrowCharsOverflow(decoder, true); // Always throw, they need at least 1 char even in Convert
// Used this one, clean up extra bits
bitCount -= 16;
}
// Loop through the input
while (buffer.MoreData)
{
byte currentByte = buffer.GetNextByte();
int c;
if (bitCount >= 0)
{
//
// Modified base 64 encoding.
//
sbyte v;
if (currentByte < 0x80 && ((v = base64Values[currentByte]) >=0))
{
firstByte = false;
bits = (bits << 6) | ((byte)v);
bitCount += 6;
if (bitCount >= 16)
{
c = (bits >> (bitCount - 16)) & 0xFFFF;
bitCount -= 16;
}
// If not enough bits just continue
else continue;
}
else
{
// If it wasn't a base 64 byte, everything's going to turn off base 64 mode
bitCount = -1;
if (currentByte != '-')
{
// >= 0x80 (because of 1st if statemtn)
// We need this check since the base64Values[b] check below need b <= 0x7f.
// This is not a valid base 64 byte. Terminate the shifted-sequence and
// emit this byte.
// not in base 64 table
// According to the RFC 1642 and the example code of UTF-7
// in Unicode 2.0, we should just zero-extend the invalid UTF7 byte
// Chars won't be updated unless this works, try to fallback
if (!buffer.Fallback(currentByte))
break; // Stop here, didn't throw
// Used that byte, we're done with it
continue;
}
//
// The encoding for '+' is "+-".
//
if (firstByte) c = '+';
// We just turn it off if not emitting a +, so we're done.
else continue;
}
//
// End of modified base 64 encoding block.
//
}
//.........这里部分代码省略.........
示例11: GetCharCount
[System.Security.SecurityCritical] // auto-generated
internal override unsafe int GetCharCount(byte* bytes, int count, DecoderNLS baseDecoder)
{
Contract.Assert(count >=0, "[UTF7Encoding.GetCharCount]count >=0");
Contract.Assert(bytes!=null, "[UTF7Encoding.GetCharCount]bytes!=null");
// Just call GetChars with null char* to do counting
return GetChars(bytes, count, null, 0, baseDecoder);
}
示例12: GetChars
[System.Security.SecurityCritical] // auto-generated
internal override unsafe int GetChars(byte* bytes, int byteCount,
char* chars, int charCount, DecoderNLS baseDecoder)
{
// Just need to ASSERT, this is called by something else internal that checked parameters already
Contract.Assert(bytes != null, "[ISO2022Encoding.GetChars]bytes is null");
Contract.Assert(byteCount >= 0, "[ISO2022Encoding.GetChars]byteCount is negative");
Contract.Assert(charCount >= 0, "[ISO2022Encoding.GetChars]charCount is negative");
// Fix our decoder
ISO2022Decoder decoder = (ISO2022Decoder)baseDecoder;
int iCount = 0;
switch (CodePage)
{
case 50220:
case 50221:
case 50222:
iCount = GetCharsCP5022xJP( bytes, byteCount, chars, charCount, decoder);
break;
case 50225:
iCount = GetCharsCP50225KR( bytes, byteCount, chars, charCount, decoder);
break;
// Currently 50227 is the same as 936
// case 50227:
// iCount = GetCharsCP50227CN( bytes, byteCount, chars, charCount, decoder);
// break;
case 52936:
iCount = GetCharsCP52936( bytes, byteCount, chars, charCount, decoder);
break;
default:
Contract.Assert(false, "[ISO2022Encoding.GetChars] had unexpected code page");
break;
}
return iCount;
}
示例13: GetCharCount
[System.Security.SecurityCritical] // auto-generated
internal override unsafe int GetCharCount(byte* bytes, int count, DecoderNLS baseDecoder)
{
// Just assert, we're called internally so these should be safe, checked already
Contract.Assert(bytes != null, "[ISO2022Encoding.GetCharCount]bytes is null");
Contract.Assert(count >= 0, "[ISO2022Encoding.GetCharCount]byteCount is negative");
// Just call getChars with null char* to get count
return GetChars(bytes, count, null, 0, baseDecoder);
}
示例14: GetChars
internal override unsafe int GetChars(byte* bytes, int byteCount, char* chars, int charCount, DecoderNLS baseDecoder)
{
ISCIIDecoder decoder = (ISCIIDecoder) baseDecoder;
Encoding.EncodingCharBuffer buffer = new Encoding.EncodingCharBuffer(this, decoder, chars, charCount, bytes, byteCount);
int defaultCodePage = this.defaultCodePage;
bool bLastATR = false;
bool bLastVirama = false;
bool bLastDevenagariStressAbbr = false;
char cLastCharForNextNukta = '\0';
char cLastCharForNoNextNukta = '\0';
if (decoder != null)
{
defaultCodePage = decoder.currentCodePage;
bLastATR = decoder.bLastATR;
bLastVirama = decoder.bLastVirama;
bLastDevenagariStressAbbr = decoder.bLastDevenagariStressAbbr;
cLastCharForNextNukta = decoder.cLastCharForNextNukta;
cLastCharForNoNextNukta = decoder.cLastCharForNoNextNukta;
}
bool flag4 = ((bLastVirama | bLastATR) | bLastDevenagariStressAbbr) | (cLastCharForNextNukta != '\0');
int num2 = -1;
if ((defaultCodePage >= 2) && (defaultCodePage <= 11))
{
num2 = IndicMappingIndex[defaultCodePage];
}
while (buffer.MoreData)
{
byte nextByte = buffer.GetNextByte();
if (flag4)
{
flag4 = false;
if (bLastATR)
{
if ((nextByte >= 0x42) && (nextByte <= 0x4b))
{
defaultCodePage = nextByte & 15;
num2 = IndicMappingIndex[defaultCodePage];
bLastATR = false;
continue;
}
if (nextByte == 0x40)
{
defaultCodePage = this.defaultCodePage;
num2 = -1;
if ((defaultCodePage >= 2) && (defaultCodePage <= 11))
{
num2 = IndicMappingIndex[defaultCodePage];
}
bLastATR = false;
continue;
}
if (nextByte == 0x41)
{
defaultCodePage = this.defaultCodePage;
num2 = -1;
if ((defaultCodePage >= 2) && (defaultCodePage <= 11))
{
num2 = IndicMappingIndex[defaultCodePage];
}
bLastATR = false;
continue;
}
if (!buffer.Fallback((byte) 0xef))
{
break;
}
bLastATR = false;
}
else if (bLastVirama)
{
if (nextByte == 0xe8)
{
if (!buffer.AddChar(''))
{
break;
}
bLastVirama = false;
continue;
}
if (nextByte == 0xe9)
{
if (!buffer.AddChar(''))
{
break;
}
bLastVirama = false;
continue;
}
bLastVirama = false;
}
else if (bLastDevenagariStressAbbr)
{
if (nextByte == 0xb8)
{
if (!buffer.AddChar('॒'))
{
break;
}
bLastDevenagariStressAbbr = false;
continue;
//.........这里部分代码省略.........
示例15: GetCharCount
internal override unsafe int GetCharCount(byte* bytes, int count, DecoderNLS baseDecoder)
{
return this.GetChars(bytes, count, null, 0, baseDecoder);
}