public Decoder(EncodingProfile profile) { _profile = profile; _buffer = new byte[6]; _bytes = 0; _bytesNeeded = 0; }
//これはメインスレッドから呼び出すこと public virtual void FullReset() { lock (_document) { ChangeMode(TerminalMode.Normal); _document.ClearScrollingRegion(); ResetInternal(); _decoder = new ISO2022CharDecoder(this, EncodingProfile.Get(GetTerminalSettings().Encoding)); } }
public T Get(EncodingType encodingType) { if (_instance == null || _encodingProfile == null || _encodingProfile.Type != encodingType) { _encodingProfile = EncodingProfile.Create(encodingType); _instance = _creator(_encodingProfile); } return(_instance); }
//これはメインスレッドから呼び出すこと public virtual void FullReset() { lock (_document) { ChangeMode(TerminalMode.Normal); _document.ClearScrollingRegion(); ResetInternal(); _encodingProfile = EncodingProfile.Create(GetTerminalSettings().Encoding); _decoder = new ISO2022CharDecoder(this, _encodingProfile); _unicodeCharConverter = _encodingProfile.CreateUnicodeCharConverter(); } }
public void Reset() { var currentEncodingSetting = GetTerminalSettings().Encoding; if (_encodingProfile.Type != currentEncodingSetting) { _encodingProfile = EncodingProfile.Create(currentEncodingSetting); _decoder = new ISO2022CharDecoder(this, _encodingProfile); _unicodeCharConverter = _encodingProfile.CreateUnicodeCharConverter(); } }
public void Reset() { //Encodingが同じ時は簡単に済ませることができる if (_decoder.CurrentEncoding.Type == GetTerminalSettings().Encoding) { _decoder.Reset(_decoder.CurrentEncoding); } else { _decoder = new ISO2022CharDecoder(this, EncodingProfile.Get(GetTerminalSettings().Encoding)); } }
public static EncodingProfile Get(EncodingType et) { EncodingProfile p = null; switch (et) { case EncodingType.ISO8859_1: p = new ISO8859_1Profile(); break; case EncodingType.EUC_JP: p = new EUCJPProfile(); break; case EncodingType.SHIFT_JIS: p = new ShiftJISProfile(); break; case EncodingType.UTF8: p = new UTF8Profile(); break; case EncodingType.UTF8_Latin: p = new UTF8_LatinProfile(); break; case EncodingType.GB2312: p = new GB2312Profile(); break; case EncodingType.BIG5: p = new Big5Profile(); break; case EncodingType.EUC_CN: p = new EUCCNProfile(); break; case EncodingType.EUC_KR: p = new EUCKRProfile(); break; case EncodingType.OEM850: p = new OEM850Profile(); break; case EncodingType.IBM437: p = new IBM437Profile(); break; } return(p); }
public JapaneseCharDecoder(TerminalConnection con) { _jisbuf = new MemoryStream(0x1000); _state = State.Normal; _connection = con; _encoding = con.Param.EncodingProfile; _iso2022jpByteProcessor = new ByteProcessor(this.ProcessByteAsISO2022JP); _DECLineByteProcessor = new ByteProcessor(this.ProcessByteAsDECLine); _currentByteProcessor = null; _G0ByteProcessor = null; _G1ByteProcessor = null; }
public ISO2022CharDecoder(ICharProcessor processor, EncodingProfile enc) { _escseq = new EscapeSequenceBuffer(); _processor = processor; _state = State.Normal; _encoding = enc; _asciiByteProcessor = new ASCIIByteProcessor(processor); _currentByteProcessor = _asciiByteProcessor; _G0ByteProcessor = _asciiByteProcessor; _G1ByteProcessor = _asciiByteProcessor; _byteProcessorBuffer = new ByteProcessorBuffer(); }
public void SendChar(char ch) //ISからのコールバックあるので { if (ch < 0x80) { //Debug.WriteLine("SendChar " + (int)ch); _sendCharBuffer[0] = (byte)ch; SendBytes(_sendCharBuffer); } else { byte[] data = EncodingProfile.Get(GetTerminalSettings().Encoding).GetBytes(ch); SendBytes(data); } }
private void mwgSendChar(char ch) { if (ch < 0x80) { // Unicode の 0x80<=ch<0x100 は、文字コードによって異なる mwgSendCharBuff[0] = (byte)ch; mwgSendBytes(mwgSendCharBuff, 1); } else { int len = EncodingProfile.Get(GetTerminalSettings().Encoding).GetBytes(ch, mwgSendCharBuff); mwgSendBytes(mwgSendCharBuff, len); } }
public AbstractTerminal(TerminalInitializeInfo info) { TerminalEmulatorPlugin.Instance.LaterInitialize(); _session = info.Session; //_invalidateParam = new InvalidateParam(); _document = new TerminalDocument(info.InitialWidth, info.InitialHeight); _document.SetOwner(_session.ISession); _afterExitLockActions = new List <AfterExitLockDelegate>(); _encodingProfile = EncodingProfile.Create(info.Session.TerminalSettings.Encoding); _decoder = new ISO2022CharDecoder(this, _encodingProfile); _unicodeCharConverter = _encodingProfile.CreateUnicodeCharConverter(); _terminalMode = TerminalMode.Normal; _currentdecoration = TextDecoration.Default; _manipulator = new GLineManipulator(); _scrollBarValues = new ScrollBarValues(); _logService = new LogService(info.TerminalParameter, _session.TerminalSettings); _promptRecognizer = new PromptRecognizer(this); _intelliSense = new IntelliSense(this); _commandResultRecognizer = new PopupStyleCommandResultRecognizer(this); if (info.Session.TerminalSettings.LogSettings != null) { _logService.ApplyLogSettings(_session.TerminalSettings.LogSettings, false); } //event handlers ITerminalSettings ts = info.Session.TerminalSettings; ts.ChangeEncoding += delegate(EncodingType t) { this.Reset(); }; ts.ChangeRenderProfile += delegate(RenderProfile prof) { TerminalControl tc = _session.TerminalControl; if (tc != null) { tc.ApplyRenderProfile(prof); } }; }
public void Reset(EncodingProfile enc) { _encoding.Reset(); _encoding = enc; _encoding.Reset(); }
//改行は入っていない前提で /// <summary> /// <ja> /// Char型の配列を送信します。 /// </ja> /// <en> /// Send a array of Char type. /// </en> /// </summary> /// <param name="chars"><ja>送信する文字配列</ja><en>String array to send</en></param> /// <remarks> /// <ja> /// 文字は現在のエンコード設定によりエンコードされてから送信されます。 /// </ja> /// <en> /// After it is encoded by a present encode setting, the character is transmitted. /// </en> /// </remarks> public void SendString(char[] chars) { byte[] data = EncodingProfile.Get(_settings.Encoding).GetBytes(chars); Transmit(data); }
public Encoder(EncodingProfile profile) { _profile = profile; _buff = new char[2]; _needLowSurrogate = false; }
public void InvalidCharDetected(byte[] buf) { CharDecodeError(String.Format(GEnv.Strings.GetString("Message.AbstractTerminal.UnexpectedChar"), EncodingProfile.Get(GetTerminalSettings().Encoding).Encoding.WebName)); }
public void SendCharArray(char[] chs) { byte[] bytes = EncodingProfile.Get(GetTerminalSettings().Encoding).GetBytes(chs); SendBytes(bytes); }