Esempio n. 1
0
 /// <summary>
 /// - Processes a character event into an Action that occurs while in the DcsParam state.
 ///   Events in this state will:
 ///   1. Ignore C0 control characters
 ///   2. Ignore Delete characters
 ///   3. Collect DCS parameter data
 ///   4. Enter DcsIntermediate if we see an intermediate
 ///   5. Begin to ignore all remaining parameters when an invalid character is detected (DcsIgnore)
 ///   6. Dispatch the Final character in preparation for parsing the data string
 /// </summary>
 /// <param name="ch"></param>
 private void EventDCSParam(byte ch)
 {
     if (ASCIIChars.IsC0Code(ch))
     {
         this.ActionIgnore(ch);
     }
     else if (ASCIIChars.IsDelete(ch))
     {
         this.ActionIgnore(ch);
     }
     else if (ASCIIChars.IsNumericParamValue(ch) || ASCIIChars.IsParameterDelimiter(ch))
     {
         this.ActionParam(ch);
     }
     else if (ASCIIChars.IsIntermediate(ch))
     {
         this.ActionCollect(ch);
         this.EnterDCSIntermediate();
     }
     else if (ASCIIChars.IsParameterInvalid(ch))
     {
         this.EnterDCSIgnore();
     }
     else
     {
         this.ActionDCSDispatch(ch);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// - Processes a character event into an Action that occurs while in the CsiEntry state.
 ///   Events in this state will:
 ///   1. Execute C0 control characters
 ///   2. Ignore Delete characters
 ///   3. Collect Intermediate characters
 ///   4. Begin to ignore all remaining parameters when an invalid character is detected (CsiIgnore)
 ///   5. Store parameter data
 ///   6. Collect Control Sequence Private markers
 ///   7. Dispatch a control sequence with parameters for action
 /// </summary>
 /// <param name="ch"></param>
 private void EventCSIEntry(byte ch)
 {
     if (ASCIIChars.IsC0Code(ch))
     {
         this.ActionExecute(ch);
     }
     else if (ASCIIChars.IsDelete(ch))
     {
         this.ActionIgnore(ch);
     }
     else if (ASCIIChars.IsIntermediate(ch))
     {
         this.ActionCollect(ch);
         this.EnterCSIIntermediate();
     }
     else if (ASCIIChars.IsCSIInvalid(ch))
     {
         this.EnterCSIIgnore();
     }
     else if (ASCIIChars.IsNumericParamValue(ch) || ASCIIChars.IsParameterDelimiter(ch))
     {
         this.ActionParam(ch);
         this.EnterCSIParam();
     }
     else if (ASCIIChars.IsCSIPrivateMarker(ch))
     {
         this.ActionCollect(ch);
         this.EnterCSIParam();
     }
     else
     {
         this.ActionCSIDispatch(ch);
         this.EnterGround();
     }
 }
Esempio n. 3
0
 /// <summary>
 /// - Processes a character event into an Action that occurs while in the EscapeIntermediate state.
 ///   Events in this state will:
 ///   1. Execute C0 control characters
 ///   2. Ignore Delete characters
 ///   3. Collect Intermediate characters
 ///   4. Dispatch an Escape action.
 /// </summary>
 /// <param name="ch"></param>
 private void EventEscapeIntermediate(byte ch)
 {
     if (ASCIIChars.IsC0Code(ch))
     {
         this.ActionExecute(ch);
     }
     else if (ASCIIChars.IsIntermediate(ch))
     {
         this.ActionCollect(ch);
     }
     else if (ASCIIChars.IsDelete(ch))
     {
         this.ActionIgnore(ch);
     }
     else if (this.isAnsiMode)
     {
         this.ActionEscDispatch(ch);
         this.EnterGround();
     }
     else if (ASCIIChars.IsVt52CursorAddress(ch))
     {
         this.EnterVt52Param();
     }
     else
     {
         this.ActionVt52EscDispatch(ch);
         this.EnterGround();
     }
 }
Esempio n. 4
0
 /// <summary>
 /// 当状态变成Escape的时候触发
 /// </summary>
 /// <param name="ch"></param>
 private void EventEscape(byte ch)
 {
     if (ASCIIChars.IsC0Code(ch))
     {
         this.ActionExecute(ch);
     }
     else if (ASCIIChars.IsDelete(ch))
     {
         this.ActionIgnore(ch);
     }
     else if (ASCIIChars.IsIntermediate(ch))
     {
         this.ActionCollect(ch);
         this.EnterEscapeIntermediate();
     }
     else if (this.isAnsiMode)
     {
         if (ASCIIChars.IsCSIIndicator(ch))
         {
             // 0x5B,进入到了csi entry状态
             this.EnterCSIEntry();
         }
         else if (ASCIIChars.IsOSCIndicator(ch))
         {
             // 0x5D,进入到了osc状态
             this.EnterOSCParam();
         }
         else if (ASCIIChars.IsDCSIndicator(ch))
         {
             // 0x50,进入到了dcs状态
             this.EnterDCSEntry();
         }
         else
         {
             this.ActionEscDispatch(ch);
             this.EnterGround();
         }
     }
     else if (ASCIIChars.IsVt52CursorAddress(ch))
     {
         // 判断是否是VT52模式下的移动光标指令, 当进入了VT52模式下才会触发
         // 在VT52模式下只有移动光标的指令有参数,所以这里把移动光标的指令单独做处理
         this.EnterVt52Param();
     }
     else
     {
         // 这里是其他的不带参数的VT52控制字符
         this.ActionVt52EscDispatch(ch);
         this.EnterGround();
     }
 }
Esempio n. 5
0
 /// <summary>
 /// - Processes a character event into an Action that occurs while in the DcsIntermediate state.
 ///   Events in this state will:
 ///   1. Ignore C0 control characters
 ///   2. Ignore Delete characters
 ///   3. Collect intermediate data.
 ///   4. Begin to ignore all remaining intermediates when an invalid character is detected (DcsIgnore)
 ///   5. Dispatch the Final character in preparation for parsing the data string
 /// </summary>
 /// <param name="ch"></param>
 private void EventDCSIntermediate(byte ch)
 {
     if (ASCIIChars.IsC0Code(ch))
     {
         this.ActionIgnore(ch);
     }
     else if (ASCIIChars.IsDelete(ch))
     {
         this.ActionIgnore(ch);
     }
     else if (ASCIIChars.IsIntermediate(ch))
     {
         this.ActionCollect(ch);
     }
     else if (ASCIIChars.IsIntermediateInvalid(ch))
     {
         this.EnterDCSIgnore();
     }
     else
     {
         this.ActionDCSDispatch(ch);
     }
 }
Esempio n. 6
0
 /// <summary>
 ///  Processes a character event into an Action that occurs while in the CsiIgnore state.
 ///   Events in this state will:
 ///   1. Execute C0 control characters
 ///   2. Ignore Delete characters
 ///   3. Collect Intermediate characters
 ///   4. Begin to ignore all remaining parameters when an invalid character is detected (CsiIgnore)
 ///   5. Return to Ground
 /// </summary>
 /// <param name="ch"></param>
 private void EventCSIIgnore(byte ch)
 {
     if (ASCIIChars.IsC0Code(ch))
     {
         this.ActionExecute(ch);
     }
     else if (ASCIIChars.IsDelete(ch))
     {
         this.ActionIgnore(ch);
     }
     else if (ASCIIChars.IsIntermediate(ch))
     {
         this.ActionIgnore(ch);
     }
     else if (ASCIIChars.IsIntermediateInvalid(ch))
     {
         this.ActionIgnore(ch);
     }
     else
     {
         this.EnterGround();
     }
 }