public void Deserialize(LocalShellParameter tp, StructuredText node) { base.Deserialize(tp, node); tp.Home = node.Get("home", CygwinUtil.DefaultHome); tp.ShellName = node.Get("shellName", CygwinUtil.DefaultShell); tp.CygwinDir = node.Get("cygwin-directory", CygwinUtil.DefaultCygwinDir); }
public void Deserialize(LocalShellParameter tp, StructuredText node) { base.Deserialize(tp, node); tp.Home = node.Get("home", CygwinUtil.DefaultHome); tp.ShellName = node.Get("shellName", CygwinUtil.DefaultShell); tp.CygwinDir = node.Get("cygwin-directory", CygwinUtil.DefaultCygwinDir); }
public void Deserialize(TCPParameter tp, StructuredText node) { base.Deserialize(tp, node); tp.Destination = node.Get("destination", ""); Debug.Assert(tp.Destination != null); tp.Port = ParseUtil.ParseInt(node.Get("port"), _defaultPort); }
public object Deserialize(StructuredText node) { SerialTerminalParam tp = new SerialTerminalParam(); tp.Port = ParseUtil.ParseInt(node.Get("Port"), 1); tp.SetTerminalName(node.Get("TerminalType", "vt100")); tp.AutoExecMacroPath = node.Get("autoexec-macro", null); return(tp); }
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 object Deserialize(StructuredText node) { SerialTerminalParam tp = new SerialTerminalParam(); if (node.Get("Port") != null) { // accept old parameter. // "PortName" setting overwrites this setting. tp.PortName = "COM" + node.Get("Port"); } tp.PortName = node.Get("PortName", tp.PortName); tp.SetTerminalName(node.Get("TerminalType", "vt100")); tp.AutoExecMacroPath = node.Get("autoexec-macro", null); return(tp); }
public void Deserialize(SSHLoginParameter tp, StructuredText node) { base.Deserialize(tp, node); tp.Method = "SSH1".Equals(node.Get("method")) ? SSHProtocol.SSH1 : SSHProtocol.SSH2; tp.AuthenticationType = ParseUtil.ParseEnum <AuthenticationType>(node.Get("authentication", ""), AuthenticationType.Password); tp.Account = node.Get("account", ""); tp.IdentityFileName = node.Get("identityFileName", ""); if (ProtocolsPlugin.Instance.ProtocolOptions.ReadSerializedPassword) { string pw = node.Get("passphrase", null); if (pw != null) { tp.PasswordOrPassphrase = pw; tp.LetUserInputPassword = false; } else { pw = node.Get("password", null); if (pw != null) { pw = new SimpleStringEncrypt().DecryptString(pw); if (pw != null) { tp.PasswordOrPassphrase = pw; tp.LetUserInputPassword = false; } } } } tp.EnableAgentForwarding = GetBoolValue(node, "enableAgentForwarding", false); tp.EnableX11Forwarding = GetBoolValue(node, "enableX11Forwarding", false); StructuredText x11Node = node.FindChild("x11Forwarding"); if (x11Node != null) { int display = GetIntValue(x11Node, "display", 0); X11ForwardingParams x11params = new X11ForwardingParams(display); x11params.Screen = GetIntValue(x11Node, "screen", 0); x11params.NeedAuth = GetBoolValue(x11Node, "needAuth", false); x11params.XauthorityFile = x11Node.Get("xauthorityFile", null); x11params.UseCygwinUnixDomainSocket = GetBoolValue(x11Node, "useCygwinUnixDomainSocket", false); x11params.X11UnixFolder = x11Node.Get("x11UnixFolder", null); tp.X11Forwarding = x11params; } }
public void Telnet0() { TelnetParameter p1 = new TelnetParameter(); StructuredText t = _telnetSerializer.Serialize(p1); Assert.IsNull(t.Parent); Assert.IsNull(t.Get("port")); TelnetParameter p2 = (TelnetParameter)_telnetSerializer.Deserialize(t); Assert.AreEqual(23, p2.Port); Assert.AreEqual(TerminalParameter.DEFAULT_TERMINAL_TYPE, p2.TerminalType); }
public override object Deserialize(StructuredText node) { TelnetParameter t = new TelnetParameter(); base.Deserialize(t, node); // Note: // for the backward compatibility, TelnetNewLine becomes false // if parameter "telnetNewLine" doesn't exist. t.TelnetNewLine = Boolean.Parse(node.Get("telnetNewLine", Boolean.FalseString)); return t; }
public void SSH0() { SSHLoginParameter p1 = new SSHLoginParameter(); StructuredText t = _sshSerializer.Serialize(p1); //確認 StringWriter wr = new StringWriter(); new TextStructuredTextWriter(wr).Write(t); wr.Close(); Debug.WriteLine(wr.ToString()); Assert.IsNull(t.Get("port")); Assert.IsNull(t.Get("method")); Assert.IsNull(t.Get("authentication")); Assert.IsNull(t.Get("identityFileName")); SSHLoginParameter p2 = (SSHLoginParameter)_sshSerializer.Deserialize(t); Assert.AreEqual(22, p2.Port); Assert.AreEqual(SSHProtocol.SSH2, p2.Method); Assert.AreEqual(AuthenticationType.Password, p2.AuthenticationType); Assert.AreEqual("", p2.IdentityFileName); }
private int GetIntValue(StructuredText node, string key, int defaultValue) { string str = node.Get(key); if (str != null) { int val; if (Int32.TryParse(str, out val)) { return val; } } return defaultValue; }
private bool GetBoolValue(StructuredText node, string key, bool defaultValue) { string str = node.Get(key); if (str != null) { bool val; if (Boolean.TryParse(str, out val)) { return val; } } return defaultValue; }
public void Deserialize(SSHLoginParameter tp, StructuredText node) { base.Deserialize(tp, node); tp.Method = "SSH1".Equals(node.Get("method")) ? SSHProtocol.SSH1 : SSHProtocol.SSH2; tp.AuthenticationType = ParseUtil.ParseEnum <AuthenticationType>(node.Get("authentication", ""), AuthenticationType.Password); tp.Account = node.Get("account", ""); tp.IdentityFileName = node.Get("identityFileName", ""); if (ProtocolsPlugin.Instance.ProtocolOptions.ReadSerializedPassword) { string pw = node.Get("passphrase", null); if (pw != null) { tp.PasswordOrPassphrase = pw; tp.LetUserInputPassword = false; } else { pw = node.Get("password", null); if (pw != null) { pw = new SimpleStringEncrypt().DecryptString(pw); if (pw != null) { tp.PasswordOrPassphrase = pw; tp.LetUserInputPassword = false; } } } } }
public void LoadFrom(StructuredText node) { Init(); foreach (Tag tag in _data) { string key_description = node.Get(tag.Command.CommandID); Keys key = key_description == null ? tag.Command.DefaultShortcutKey : WinFormsUtil.ParseKey(key_description.Split('+')); tag.Key = key; if (key != Keys.None) { _keyToTag.Add(key, tag); } } }
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 object Deserialize(StructuredText node) { SerialTerminalSettings ts = SerialPortUtil.CreateDefaultSerialTerminalSettings(1); //TODO Deserializeの別バージョンを作ってimportさせるべきだろう。もしくはService側の実装から変える。要素側には空引数コンストラクタを強制すればいいか StructuredText basenode = node.FindChild(typeof(TerminalSettings).FullName); if (basenode != null) { ts.BaseImport((ITerminalSettings)SerialPortPlugin.Instance.SerializeService.Deserialize(basenode)); } ts.BaudRate = ParseUtil.ParseInt(node.Get("baud-rate"), 9600); ts.ByteSize = (byte)ParseUtil.ParseInt(node.Get("byte-size"), 8); ts.Parity = ParseUtil.ParseEnum <Parity>(node.Get("parity"), Parity.NOPARITY); ts.StopBits = ParseUtil.ParseEnum <StopBits>(node.Get("stop-bits"), StopBits.ONESTOPBIT); ts.FlowControl = ParseUtil.ParseEnum <FlowControl>(node.Get("flow-control"), FlowControl.None); ts.TransmitDelayPerChar = ParseUtil.ParseInt(node.Get("delay-per-char"), 0); ts.TransmitDelayPerLine = ParseUtil.ParseInt(node.Get("delay-per-line"), 0); return(ts); }
public object Deserialize(StructuredText node) { PipeTerminalParameter tp = new PipeTerminalParameter(); tp.ExeFilePath = node.Get("exeFilePath", null); tp.CommandLineOptions = node.Get("commandLineOptions", null); List<PipeTerminalParameter.EnvironmentVariable> envList = new List<PipeTerminalParameter.EnvironmentVariable>(); foreach (StructuredText s in node.FindMultipleNote("environmentVariable")) { string name = s.Get("name", null); string value = s.Get("value", null); if (name != null && value != null) { envList.Add(new PipeTerminalParameter.EnvironmentVariable(name, value)); } } tp.EnvironmentVariables = (envList.Count > 0) ? envList.ToArray() : null; tp.InputPipePath = node.Get("inputPipePath", null); tp.OutputPipePath = node.Get("outputPipePath", null); tp.SetTerminalName(node.Get("terminal-type", "vt100")); tp.AutoExecMacroPath = node.Get("autoexec-macro", null); return tp; }
public object Deserialize(StructuredText node) { PipeTerminalParameter tp = new PipeTerminalParameter(); tp.ExeFilePath = node.Get("exeFilePath", null); tp.CommandLineOptions = node.Get("commandLineOptions", null); List <PipeTerminalParameter.EnvironmentVariable> envList = new List <PipeTerminalParameter.EnvironmentVariable>(); foreach (StructuredText s in node.FindMultipleNote("environmentVariable")) { string name = s.Get("name", null); string value = s.Get("value", null); if (name != null && value != null) { envList.Add(new PipeTerminalParameter.EnvironmentVariable(name, value)); } } tp.EnvironmentVariables = (envList.Count > 0) ? envList.ToArray() : null; tp.InputPipePath = node.Get("inputPipePath", null); tp.OutputPipePath = node.Get("outputPipePath", null); tp.SetTerminalName(node.Get("terminal-type", "vt100")); tp.AutoExecMacroPath = node.Get("autoexec-macro", null); return(tp); }
public object Deserialize(StructuredText node) { SerialTerminalParam tp = new SerialTerminalParam(); tp.Port = ParseUtil.ParseInt(node.Get("Port"), 1); tp.SetTerminalName(node.Get("TerminalType", "vt100")); tp.AutoExecMacroPath = node.Get("autoexec-macro", null); return tp; }
public void Deserialize(TerminalParameter tp, StructuredText node) { tp.SetTerminalName(node.Get("terminal-type", TerminalParameter.DEFAULT_TERMINAL_TYPE)); tp.AutoExecMacroPath = node.Get("autoexec-macro", null); }
public object Deserialize(StructuredText node) { SerialTerminalSettings ts = SerialPortUtil.CreateDefaultSerialTerminalSettings(1); //TODO Deserialize�̕ʃo�[�W����������import������ׂ����낤�B�������Service���̎�������ς���B�v�f���ɂ͋�����R���X�g���N�^�������������� StructuredText basenode = node.FindChild(typeof(TerminalSettings).FullName); if (basenode != null) ts.BaseImport((ITerminalSettings)SerialPortPlugin.Instance.SerializeService.Deserialize(basenode)); ts.BaudRate = ParseUtil.ParseInt(node.Get("baud-rate"), 9600); ts.ByteSize = (byte)ParseUtil.ParseInt(node.Get("byte-size"), 8); ts.Parity = ParseUtil.ParseEnum<Parity>(node.Get("parity"), Parity.NOPARITY); ts.StopBits = ParseUtil.ParseEnum<StopBits>(node.Get("stop-bits"), StopBits.ONESTOPBIT); ts.FlowControl = ParseUtil.ParseEnum<FlowControl>(node.Get("flow-control"), FlowControl.None); ts.TransmitDelayPerChar = ParseUtil.ParseInt(node.Get("delay-per-char"), 0); ts.TransmitDelayPerLine = ParseUtil.ParseInt(node.Get("delay-per-line"), 0); return ts; }
public void Deserialize(SSHSubsystemParameter tp, StructuredText node) { base.Deserialize(tp, node); tp.SubsystemName = node.Get("subsystemName", ""); }
public void Deserialize(SSHSubsystemParameter tp, StructuredText node) { base.Deserialize(tp, node); tp.SubsystemName = node.Get("subsystemName", ""); }
public object Deserialize(StructuredText node) { SerialTerminalSettings ts = SerialPortUtil.CreateDefaultSerialTerminalSettings("COM1"); //TODO Deserializeの別バージョンを作ってimportさせるべきだろう。もしくはService側の実装から変える。要素側には空引数コンストラクタを強制すればいいか StructuredText basenode = node.FindChild(typeof(TerminalSettings).FullName); if (basenode != null) ts.BaseImport((ITerminalSettings)SerialPortPlugin.Instance.SerializeService.Deserialize(basenode)); ts.BaudRate = ParseUtil.ParseInt(node.Get("baud-rate"), 9600); ts.ByteSize = (byte)ParseUtil.ParseInt(node.Get("byte-size"), 8); ts.Parity = ParseUtil.ParseEnum<Parity>(node.Get("parity"), Parity.NOPARITY); ts.StopBits = ParseUtil.ParseEnum<StopBits>(node.Get("stop-bits"), StopBits.ONESTOPBIT); ts.FlowControl = ParseUtil.ParseEnum<FlowControl>(node.Get("flow-control"), FlowControl.None); ts.TransmitDelayPerChar = ParseUtil.ParseInt(node.Get("delay-per-char"), 0); ts.TransmitDelayPerLine = ParseUtil.ParseInt(node.Get("delay-per-line"), 0); return ts; }
public void Deserialize(TCPParameter tp, StructuredText node) { base.Deserialize(tp, node); tp.Destination = node.Get("destination", ""); Debug.Assert(tp.Destination != null); tp.Port = ParseUtil.ParseInt(node.Get("port"), _defaultPort); }
private int GetIntValue(StructuredText node, string key, int defaultValue) { string str = node.Get(key); if (str != null) { int val; if (Int32.TryParse(str, out val)) { return val; } } return defaultValue; }
private bool GetBoolValue(StructuredText node, string key, bool defaultValue) { string str = node.Get(key); if (str != null) { bool val; if (Boolean.TryParse(str, out val)) { return val; } } return defaultValue; }
public void Deserialize(SSHLoginParameter tp, StructuredText node) { base.Deserialize(tp, node); tp.Method = "SSH1".Equals(node.Get("method")) ? SSHProtocol.SSH1 : SSHProtocol.SSH2; tp.AuthenticationType = ParseUtil.ParseEnum<AuthenticationType>(node.Get("authentication", ""), AuthenticationType.Password); tp.Account = node.Get("account", ""); tp.IdentityFileName = node.Get("identityFileName", ""); if (ProtocolsPlugin.Instance.ProtocolOptions.ReadSerializedPassword) { string pw = node.Get("passphrase", null); if (pw != null) { tp.PasswordOrPassphrase = pw; tp.LetUserInputPassword = false; } else { pw = node.Get("password", null); if (pw != null) { pw = new SimpleStringEncrypt().DecryptString(pw); if (pw != null) { tp.PasswordOrPassphrase = pw; tp.LetUserInputPassword = false; } } } } tp.EnableAgentForwarding = GetBoolValue(node, "enableAgentForwarding", false); tp.EnableX11Forwarding = GetBoolValue(node, "enableX11Forwarding", false); StructuredText x11Node = node.FindChild("x11Forwarding"); if (x11Node != null) { int display = GetIntValue(x11Node, "display", 0); X11ForwardingParams x11params = new X11ForwardingParams(display); x11params.Screen = GetIntValue(x11Node, "screen", 0); x11params.NeedAuth = GetBoolValue(x11Node, "needAuth", false); x11params.XauthorityFile = x11Node.Get("xauthorityFile", null); x11params.UseCygwinUnixDomainSocket = GetBoolValue(x11Node, "useCygwinUnixDomainSocket", false); x11params.X11UnixFolder = x11Node.Get("x11UnixFolder", null); tp.X11Forwarding = x11params; } }
public object Deserialize(StructuredText storage) { RenderProfile prof = new RenderProfile(); prof.FontName = storage.Get("font-name", "Courier New"); prof.CJKFontName = storage.Get("cjk-font-name", storage.Get("japanese-font-name", storage.Get("chinese-font-name", "Courier New"))); prof.FontSize = ParseUtil.ParseFloat(storage.Get("font-size"), 10.0f); prof.LineSpacing = ParseUtil.ParseInt(storage.Get("line-spacing"), 0); prof.UseClearType = ParseUtil.ParseBool(storage.Get("clear-type"), false); prof.EnableBoldStyle = ParseUtil.ParseBool(storage.Get("enable-bold-style"), true); prof.ForceBoldStyle = ParseUtil.ParseBool(storage.Get("force-bold-style"), false); prof.ForeColor = ParseUtil.ParseColor(storage.Get("text-color"), Color.FromKnownColor(KnownColor.WindowText)); prof.BackColor = ParseUtil.ParseColor(storage.Get("back-color"), Color.FromKnownColor(KnownColor.Window)); prof.ImageStyle = ParseUtil.ParseEnum<ImageStyle>(storage.Get("back-style"), ImageStyle.Center); prof.BackgroundImageFileName = storage.Get("back-image", ""); prof.ESColorSet = new EscapesequenceColorSet(); string escolor = storage.Get("escape-sequence-color"); if (escolor != null) prof.ESColorSet.Load(escolor); prof.DarkenEsColorForBackground = ParseUtil.ParseBool(storage.Get("darken-escolor-for-background"), true); return prof; }
public void LoadFrom(StructuredText node) { Init(); foreach (Tag tag in _data) { string key_description = node.Get(tag.Command.CommandID); Keys key = key_description == null ? tag.Command.DefaultShortcutKey : WinFormsUtil.ParseKey(key_description.Split('+')); tag.Key = key; if (key != Keys.None) _keyToTag.Add(key, tag); } }
public object Deserialize(StructuredText storage) { RenderProfile prof = new RenderProfile(); prof.FontName = storage.Get("font-name", "Courier New"); prof.CJKFontName = storage.Get("cjk-font-name", storage.Get("japanese-font-name", storage.Get("chinese-font-name", "Courier New"))); prof.FontSize = ParseUtil.ParseFloat(storage.Get("font-size"), 10.0f); prof.LineSpacing = ParseUtil.ParseInt(storage.Get("line-spacing"), 0); prof.UseClearType = ParseUtil.ParseBool(storage.Get("clear-type"), false); prof.EnableBoldStyle = ParseUtil.ParseBool(storage.Get("enable-bold-style"), true); prof.ForceBoldStyle = ParseUtil.ParseBool(storage.Get("force-bold-style"), false); prof.ForeColor = ParseUtil.ParseColor(storage.Get("text-color"), Color.FromKnownColor(KnownColor.WindowText)); prof.BackColor = ParseUtil.ParseColor(storage.Get("back-color"), Color.FromKnownColor(KnownColor.Window)); prof.ImageStyle = ParseUtil.ParseEnum <ImageStyle>(storage.Get("back-style"), ImageStyle.Center); prof.BackgroundImageFileName = storage.Get("back-image", ""); prof.ESColorSet = new EscapesequenceColorSet(); string escolor = storage.Get("escape-sequence-color"); if (escolor != null) { prof.ESColorSet.Load(escolor); } prof.DarkenEsColorForBackground = ParseUtil.ParseBool(storage.Get("darken-escolor-for-background"), true); return(prof); }
public object Deserialize(StructuredText node) { SerialTerminalParam tp = new SerialTerminalParam(); if (node.Get("Port") != null) { // accept old parameter. // "PortName" setting overwrites this setting. tp.PortName = "COM" + node.Get("Port"); } tp.PortName = node.Get("PortName", tp.PortName); tp.SetTerminalName(node.Get("TerminalType", "vt100")); tp.AutoExecMacroPath = node.Get("autoexec-macro", null); return tp; }
public override object Deserialize(StructuredText node) { TelnetParameter t = new TelnetParameter(); base.Deserialize(t, node); // Note: // for the backward compatibility, TelnetNewLine becomes false // if parameter "telnetNewLine" doesn't exist. t.TelnetNewLine = Boolean.Parse(node.Get("telnetNewLine", Boolean.FalseString)); return t; }
public void Deserialize(TerminalParameter tp, StructuredText node) { tp.SetTerminalName(node.Get("terminal-type", TerminalParameter.DEFAULT_TERMINAL_TYPE)); tp.AutoExecMacroPath = node.Get("autoexec-macro", null); }
public void Deserialize(SSHLoginParameter tp, StructuredText node) { base.Deserialize(tp, node); tp.Method = "SSH1".Equals(node.Get("method")) ? SSHProtocol.SSH1 : SSHProtocol.SSH2; tp.AuthenticationType = ParseUtil.ParseEnum<AuthenticationType>(node.Get("authentication", ""), AuthenticationType.Password); tp.Account = node.Get("account", ""); tp.IdentityFileName = node.Get("identityFileName", ""); if (ProtocolsPlugin.Instance.ProtocolOptions.ReadSerializedPassword) { string pw = node.Get("passphrase", null); if (pw != null) { tp.PasswordOrPassphrase = pw; tp.LetUserInputPassword = false; } else { pw = node.Get("password", null); if (pw != null) { pw = new SimpleStringEncrypt().DecryptString(pw); if (pw != null) { tp.PasswordOrPassphrase = pw; tp.LetUserInputPassword = false; } } } } }