Пример #1
0
 private void ProcessByte(byte inputByte)
 {
     if (_currentByteProcessingStrategy == null)
     {
         if (inputByte == 0)
             _currentByteProcessingStrategy = new ZeroTerminateStringBuildingStrategy();
         else
             _currentByteProcessingStrategy = new FixedLengthStringBuildingStrategy(inputByte);
     }
     else
     {
         var stringBuildingState = _currentByteProcessingStrategy.ProcessByte(inputByte, ref _currentOutputString);
         if (stringBuildingState == StringBuildingState.StringComplete)
         {
             _currentByteProcessingStrategy = null;
             _outputter.OutputText(_currentOutputString);
             _currentOutputString = "";
         }
     }
 }
Пример #2
0
 private void ProcessByte(byte inputByte)
 {
     if (_currentByteProcessingStrategy == null)
     {
         if (inputByte == 0)
         {
             _currentByteProcessingStrategy = new ZeroTerminateStringBuildingStrategy();
         }
         else
         {
             _currentByteProcessingStrategy = new FixedLengthStringBuildingStrategy(inputByte);
         }
     }
     else
     {
         var stringBuildingState = _currentByteProcessingStrategy.ProcessByte(inputByte, ref _currentOutputString);
         if (stringBuildingState == StringBuildingState.StringComplete)
         {
             _currentByteProcessingStrategy = null;
             _outputter.OutputText(_currentOutputString);
             _currentOutputString = "";
         }
     }
 }