Ejemplo n.º 1
0
 public bool RestartWithNewEncoding(Encoding newEncoding)
 {
     if (encoding.CodePage == newEncoding.CodePage)
     {
         if (restartConsumer != null)
         {
             restartConsumer.DisableRestart();
             restartConsumer = null;
             if (restartCache != null)
             {
                 restartCache.Reset();
                 restartCache = null;
             }
         }
         return(false);
     }
     if (restartConsumer == null || !restartConsumer.CanRestart())
     {
         return(false);
     }
     restartConsumer.Restart();
     SetNewEncoding(newEncoding);
     encodingChanged = true;
     if (readEnd != 0 && readFileOffset != 0)
     {
         BackupForRestart(readBuffer, 0, readEnd, readFileOffset, true);
         readEnd        = 0;
         readFileOffset = 0;
     }
     readCurrent     = 0;
     pushChunkUsed   = 0;
     restartConsumer = null;
     parseStart      = (parseEnd = 0);
     restarting      = (restartCache != null && restartCache.Length != 0);
     return(true);
 }