Reset() публичный Метод

public Reset ( ) : void
Результат void
Пример #1
0
 [System.Security.SecurityCritical]  // auto-generated
 internal unsafe void InternalReset()
 {
     charStart       = null;
     bFallingBack    = false;
     iRecursionCount = 0;
     _fallbackBuffer.Reset();
 }
Пример #2
0
 public virtual void Reset()
 {
     if (fallback_buffer != null)
     {
         fallback_buffer.Reset();
     }
 }
Пример #3
0
 internal virtual void Reset()
 {
     if (fallback_buffer != null)
     {
         fallback_buffer.Reset();
     }
 }
Пример #4
0
 public override void Reset()
 {
     charLeftOver = (char)0;
     if (m_fallbackBuffer != null)
     {
         m_fallbackBuffer.Reset();
     }
 }
Пример #5
0
 public virtual void Reset()
 {
     char[] charTemp = {};
     byte[] byteTemp = new byte[GetByteCount(charTemp, 0, 0, true)];
     GetBytes(charTemp, 0, 0, byteTemp, 0, true);
     if (m_fallbackBuffer != null)
     {
         m_fallbackBuffer.Reset();
     }
 }
Пример #6
0
        unsafe static char [] GetFallbackChars(char *chars, char *start, EncoderFallback fallback, ref EncoderFallbackBuffer buffer)
        {
            if (buffer == null)
            {
                buffer = fallback.CreateFallbackBuffer();
            }

            buffer.Fallback(*chars, (int)(chars - start));

            char [] fallback_chars = new char [buffer.Remaining];
            for (int i = 0; i < fallback_chars.Length; i++)
            {
                fallback_chars [i] = buffer.GetNextChar();
            }

            buffer.Reset();

            return(fallback_chars);
        }
	unsafe static char [] GetFallbackChars (char *chars, char *start, EncoderFallback fallback, ref EncoderFallbackBuffer buffer)
	{
		if (buffer == null)
			buffer = fallback.CreateFallbackBuffer ();

		buffer.Fallback (*chars, (int) (chars - start));

		char [] fallback_chars = new char [buffer.Remaining];
		for (int i = 0; i < fallback_chars.Length; i++)
			fallback_chars [i] = buffer.GetNextChar ();

		buffer.Reset ();

		return fallback_chars;
	}
Пример #8
0
 public override void Reset()
 {
     charLeftOver = (char)0;
     m_fallbackBuffer?.Reset();
 }
Пример #9
0
	// This function is called when we want to flush the decoder state
	// (i.e. in case of invalid UTF-16 characters or dangling surrogates)
	internal unsafe static EncoderStatus InternalGetBytesFlush (
		byte* bytes, int byteCount,
		EncoderFallbackBuffer fallbackBuffer,
		int charsProcessed, ref int bytesProcessed,
		ref uint leftChar)
	{
		int t_charsProcessed, t_bytesProcessed;

		// in normal circumstances fallbackBuffer never is null, except
		// when we have called InternalGetBytes from this function
		// (for avoiding infinite recursive calls)
		if (fallbackBuffer == null)
			return EncoderStatus.Ok;

		// if there is nothing to flush, then return silently
		if(leftChar == 0)
			return EncoderStatus.Ok;

		// invalid UTF-16 or invalid surrogate
		fallbackBuffer.Fallback ((char) leftChar, charsProcessed - 1);
		// if we've arrived here we are working in replacement mode:
		// build a replacement fallback_chars buffer
		char[] fallback_chars = new char [fallbackBuffer.Remaining];
		for (int i = 0; i < fallback_chars.Length; i++)
			fallback_chars [i] = fallbackBuffer.GetNextChar ();
		fallbackBuffer.Reset ();
		// and encode it into UTF8 bytes...
		fixed (char *fb_chars = fallback_chars) {
			leftChar = 0;
			switch (bytes != null
				? InternalGetBytes (
						fb_chars, fallback_chars.Length,
						bytes + bytesProcessed, byteCount - bytesProcessed,
						null, out t_charsProcessed, out t_bytesProcessed,
						ref leftChar,
						true)
				: InternalGetBytes (
						fb_chars, fallback_chars.Length,
						null, byteCount,
						null, out t_charsProcessed, out t_bytesProcessed,
						ref leftChar,
						true)) {
			case EncoderStatus.Ok:
				// everything OK :D
				bytesProcessed += t_bytesProcessed;
				break;
			case EncoderStatus.InsufficientSpace:
				return EncoderStatus.InsufficientSpace;
			case EncoderStatus.InputRunOut:
			case EncoderStatus.InvalidChar:
			case EncoderStatus.InvalidSurrogate:
				throw new ArgumentException ("Fallback chars are pure evil.", "fallback buffer bytes");
			}
		}
		// flush encoder state
		leftChar = 0;
		return EncoderStatus.Ok;
	}