//Clone, でもIConeableではない。Listener類はコピーしない。
        public virtual ITerminalSettings Clone()
        {
            TerminalSettings t = new TerminalSettings();

            t.Import(this);
            return(t);
        }
Exemple #2
0
        public void Test1()
        {
            TerminalSettings ts1 = new TerminalSettings();

            ts1.BeginUpdate();
            ts1.Encoding     = EncodingType.SHIFT_JIS;
            ts1.LocalEcho    = true;
            ts1.TransmitNL   = NewLine.CRLF;
            ts1.TerminalType = TerminalType.VT100;
            ts1.EndUpdate();

            StructuredText storage = _terminalSettingsSerializer.Serialize(ts1);
            //確認
            StringWriter wr = new StringWriter();

            new TextStructuredTextWriter(wr).Write(storage);
            wr.Close();
            Debug.WriteLine(wr.ToString());

            TerminalSettings ts2 = (TerminalSettings)_terminalSettingsSerializer.Deserialize(storage);

            Assert.AreEqual(ts1.Encoding, ts2.Encoding);
            Assert.AreEqual(ts1.LocalEcho, ts2.LocalEcho);
            Assert.AreEqual(ts1.TransmitNL, ts2.TransmitNL);
            Assert.AreEqual(ts1.LineFeedRule, ts2.LineFeedRule);
            Assert.AreEqual(ts1.TerminalType, ts2.TerminalType);
        }
        public object Deserialize(StructuredText node)
        {
            TerminalSettings ts = new TerminalSettings();

            ts.BeginUpdate();

            ts.Encoding     = ParseEncodingType(node.Get("encoding", ""), EncodingType.ISO8859_1);
            ts.TerminalType = ParseUtil.ParseEnum <TerminalType>(node.Get("terminal-type"), TerminalType.XTerm);
            ts.LocalEcho    = ParseUtil.ParseBool(node.Get("localecho"), false);
            ts.LineFeedRule = ParseUtil.ParseEnum <LineFeedRule>(node.Get("linefeedrule"), LineFeedRule.Normal);
            ts.TransmitNL   = ParseUtil.ParseEnum <NewLine>(node.Get("transmit-nl"), NewLine.CR);
            ts.EnabledCharTriggerIntelliSense = ParseUtil.ParseBool(node.Get("char-trigger-intellisense"), false);
            string shellscheme = node.Get("shellscheme", ShellSchemeCollection.DEFAULT_SCHEME_NAME);

            if (shellscheme.Length > 0)
            {
                ts.SetShellSchemeName(shellscheme);
            }
            ts.Caption = node.Get("caption", "");
#if !UNITTEST
            //現在テストではRenderProfileは対象外
            StructuredText rp = node.FindChild(typeof(RenderProfile).FullName);
            if (rp != null)
            {
                ts.RenderProfile = _serializeService.Deserialize(rp) as RenderProfile;
            }
#endif
            ts.EndUpdate();
            return(ts);
        }
Exemple #4
0
        public ITerminalSettings CreateDefaultTerminalSettings(string caption, Image icon)
        {
            TerminalSettings t = new TerminalSettings();

            t.BeginUpdate();
            t.Icon    = icon;
            t.Caption = caption;
            t.EnabledCharTriggerIntelliSense = GEnv.Options.EnableComplementForNewConnections;
            t.EndUpdate();
            return(t);
        }
Exemple #5
0
        public void Test2()
        {
            StringReader   reader  = new StringReader("Poderosa.Terminal.TerminalSettings {\r\n encoding=xxx\r\n localecho=xxx\r\n transmit-nl=xxx}");
            StructuredText storage = new TextStructuredTextReader(reader).Read();

            TerminalSettings ts = (TerminalSettings)_terminalSettingsSerializer.Deserialize(storage);

            Assert.AreEqual(EncodingType.ISO8859_1, ts.Encoding);
            Assert.AreEqual(false, ts.LocalEcho);
            Assert.AreEqual(NewLine.CR, ts.TransmitNL);
            Assert.AreEqual(LineFeedRule.Normal, ts.LineFeedRule);
            Assert.AreEqual(TerminalType.XTerm, ts.TerminalType);
        }
Exemple #6
0
        public void Test0()
        {
            TerminalSettings ts1     = new TerminalSettings();
            StructuredText   storage = _terminalSettingsSerializer.Serialize(ts1);
            TerminalSettings ts2     = (TerminalSettings)_terminalSettingsSerializer.Deserialize(storage);

            Assert.AreEqual(EncodingType.EUC_JP, ts1.Encoding);
            Assert.AreEqual(false, ts1.LocalEcho);
            Assert.AreEqual(NewLine.CR, ts1.TransmitNL);
            Assert.AreEqual(LineFeedRule.Normal, ts1.LineFeedRule);
            Assert.AreEqual(TerminalType.XTerm, ts1.TerminalType);

            Assert.AreEqual(EncodingType.EUC_JP, ts2.Encoding);
            Assert.AreEqual(false, ts2.LocalEcho);
            Assert.AreEqual(NewLine.CR, ts2.TransmitNL);
            Assert.AreEqual(LineFeedRule.Normal, ts2.LineFeedRule);
            Assert.AreEqual(TerminalType.XTerm, ts2.TerminalType);
        }
        public StructuredText Serialize(object obj)
        {
            StructuredText   storage = new StructuredText(this.ConcreteType.FullName);
            TerminalSettings ts      = (TerminalSettings)obj;

            storage.Set("encoding", ts.Encoding.ToString());
            if (ts.TerminalType != TerminalType.XTerm)
            {
                storage.Set("terminal-type", ts.TerminalType.ToString());
            }
            if (ts.LocalEcho)
            {
                storage.Set("localecho", "true");
            }
            if (ts.LineFeedRule != LineFeedRule.Normal)
            {
                storage.Set("linefeedrule", ts.LineFeedRule.ToString());
            }
            if (ts.TransmitNL != NewLine.CR)
            {
                storage.Set("transmit-nl", ts.TransmitNL.ToString());
            }
            if (ts.EnabledCharTriggerIntelliSense)
            {
                storage.Set("char-trigger-intellisense", "true");
            }
            if (!ts.ShellScheme.IsGeneric)
            {
                storage.Set("shellscheme", ts.ShellScheme.Name);
            }
            storage.Set("caption", ts.Caption);
#if !UNITTEST
            //現在テストではRenderProfileは対象外
            if (!ts.UsingDefaultRenderProfile)
            {
                storage.AddChild(_serializeService.Serialize(ts.RenderProfile));
            }
#endif
            //アイコンはシリアライズしない
            return(storage);
        }
        //Listener以外を持ってくる
        public virtual void Import(ITerminalSettings src)
        {
            _encoding     = src.Encoding;
            _terminalType = src.TerminalType;
            _localecho    = src.LocalEcho;
            _lineFeedRule = src.LineFeedRule;
            _transmitnl   = src.TransmitNL;
            _caption      = src.Caption;
            _icon         = src.Icon;
            TerminalSettings src_r = (TerminalSettings)src;

            _shellSchemeName = src_r._shellSchemeName; //ちょっとインチキ
            if (src_r._shellScheme != null)
            {
                _shellScheme = src_r._shellScheme;
                TerminalEmulatorPlugin.Instance.ShellSchemeCollection.AddDynamicChangeListener(this);
            }
            _enabledCharTriggerIntelliSense = src.EnabledCharTriggerIntelliSense;
            _renderProfile    = src.RenderProfile == null ? null : (RenderProfile)src.RenderProfile.Clone();
            _multiLogSettings = src.LogSettings == null ? null : (IMultiLogSettings)_multiLogSettings.Clone();
        }
        public object Deserialize(StructuredText node) {
            TerminalSettings ts = new TerminalSettings();
            ts.BeginUpdate();

            ts.Encoding = ParseEncodingType(node.Get("encoding", ""), EncodingType.ISO8859_1);
            ts.TerminalType = ParseUtil.ParseEnum<TerminalType>(node.Get("terminal-type"), TerminalType.XTerm);
            ts.LocalEcho = ParseUtil.ParseBool(node.Get("localecho"), false);
            ts.LineFeedRule = ParseUtil.ParseEnum<LineFeedRule>(node.Get("linefeedrule"), LineFeedRule.Normal);
            ts.TransmitNL = ParseUtil.ParseEnum<NewLine>(node.Get("transmit-nl"), NewLine.CR);
            ts.EnabledCharTriggerIntelliSense = ParseUtil.ParseBool(node.Get("char-trigger-intellisense"), false);
            string shellscheme = node.Get("shellscheme", ShellSchemeCollection.DEFAULT_SCHEME_NAME);
            if (shellscheme.Length > 0)
                ts.SetShellSchemeName(shellscheme);
            ts.Caption = node.Get("caption", "");
#if !UNITTEST
            //現在テストではRenderProfileは対象外
            StructuredText rp = node.FindChild(typeof(RenderProfile).FullName);
            if (rp != null)
                ts.RenderProfile = _serializeService.Deserialize(rp) as RenderProfile;
#endif
            ts.EndUpdate();
            return ts;
        }
        public void Test1() {
            TerminalSettings ts1 = new TerminalSettings();
            ts1.BeginUpdate();
            ts1.Encoding = EncodingType.SHIFT_JIS;
            ts1.LocalEcho = true;
            ts1.TransmitNL = NewLine.CRLF;
            ts1.TerminalType = TerminalType.VT100;
            ts1.EndUpdate();

            StructuredText storage = _terminalSettingsSerializer.Serialize(ts1);
            //確認
            StringWriter wr = new StringWriter();
            new TextStructuredTextWriter(wr).Write(storage);
            wr.Close();
            Debug.WriteLine(wr.ToString());

            TerminalSettings ts2 = (TerminalSettings)_terminalSettingsSerializer.Deserialize(storage);

            Assert.AreEqual(ts1.Encoding, ts2.Encoding);
            Assert.AreEqual(ts1.LocalEcho, ts2.LocalEcho);
            Assert.AreEqual(ts1.TransmitNL, ts2.TransmitNL);
            Assert.AreEqual(ts1.LineFeedRule, ts2.LineFeedRule);
            Assert.AreEqual(ts1.TerminalType, ts2.TerminalType);
        }
        public void Test0() {
            TerminalSettings ts1 = new TerminalSettings();
            StructuredText storage = _terminalSettingsSerializer.Serialize(ts1);
            TerminalSettings ts2 = (TerminalSettings)_terminalSettingsSerializer.Deserialize(storage);

            Assert.AreEqual(EncodingType.EUC_JP, ts1.Encoding);
            Assert.AreEqual(false, ts1.LocalEcho);
            Assert.AreEqual(NewLine.CR, ts1.TransmitNL);
            Assert.AreEqual(LineFeedRule.Normal, ts1.LineFeedRule);
            Assert.AreEqual(TerminalType.XTerm, ts1.TerminalType);

            Assert.AreEqual(EncodingType.EUC_JP, ts2.Encoding);
            Assert.AreEqual(false, ts2.LocalEcho);
            Assert.AreEqual(NewLine.CR, ts2.TransmitNL);
            Assert.AreEqual(LineFeedRule.Normal, ts2.LineFeedRule);
            Assert.AreEqual(TerminalType.XTerm, ts2.TerminalType);
        }
Exemple #12
0
 //Clone, でもIConeableではない。Listener類はコピーしない。
 public virtual ITerminalSettings Clone()
 {
     TerminalSettings t = new TerminalSettings();
     t.Import(this);
     return t;
 }
 public ITerminalSettings CreateDefaultTerminalSettings(string caption, Image icon)
 {
     TerminalSettings t = new TerminalSettings();
     t.BeginUpdate();
     t.Icon = icon;
     t.Caption = caption;
     t.EnabledCharTriggerIntelliSense = GEnv.Options.EnableComplementForNewConnections;
     t.EndUpdate();
     return t;
 }
        public InternalTerminalInstance(ProtocolType protocol, InternalPoderosaInstance _internalPoderosaWorld, ITerminalParameter _IterminalParameter)
        {
            _basePoderosaInstance=_internalPoderosaWorld;
            _window = _basePoderosaInstance.WindowManagerPlugin.CreateLibraryMainWindow();

            _protocol = protocol;

            _terminalSettings = new TerminalSettings();
            _terminalParameter = _IterminalParameter;
            _terminalView = _window.ViewManager.GetCandidateViewForNewDocument();
        }