Example #1
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();
     }
 }
Example #2
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);
     }
 }
Example #3
0
 /// <summary>
 /// 进入到了OSC状态,开始解析OSC命令
 /// </summary>
 /// <param name="ch"></param>
 private void EventOSCParam(byte ch)
 {
     if (ASCIIChars.IsOSCTerminator(ch))
     {
         // OSC状态下出现了BEL结束符
         // 参考terminal的做法,进入Ground状态
         this.EnterGround();
     }
     else if (ASCIIChars.IsNumericParamValue(ch))
     {
         // OSC状态下的数字,收集起来
         this.ActionOSCParam(ch);
     }
     else if (ASCIIChars.IsOSCDelimiter(ch))
     {
         // OSC状态下出现了分隔符,说明要开始收集字符串了
         this.EnterOSCString();
     }
     else
     {
         // 其他所有的字符都忽略
         this.ActionIgnore(ch);
     }
 }