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 RemoveAssembly(string home, string[] filenames) { foreach (String f in filenames) { StructuredText t = _data.FindChild(Path.Combine(home, f)); if (t != null) { _data.RemoveChild(t); } } }
public PlugInHost(PreferencePlugin parent, IPreferenceSupplier supplier, StructuredText root, int index) { _parent = parent; _supplier = supplier; _storageNode = root.FindChild(supplier.PreferenceID); if (_storageNode == null) { _storageNode = root.AddChild(supplier.PreferenceID); //空で作成しておく } _supplierID = supplier.PreferenceID; _index = index; _sharedResult = new PreferenceValidationResult(); }
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 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) { 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("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(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; } }
internal void LoadFrom(StructuredText node) { bool dirty = false; int child_index = 0; int data_index = 0; while (child_index < _children.Count) { IPreferenceItemBase child = (IPreferenceItemBase)_children[child_index]; PreferenceFolder ch_folder = child as PreferenceFolder; PreferenceFolderArray ch_array = child as PreferenceFolderArray; PreferenceItem ch_item = child as PreferenceItem; PreferenceLooseNode ch_loose = child as PreferenceLooseNode; //TODO 以下の分岐汚すぎ、何とかする if (ch_folder != null) { StructuredText ch_data = node.GetChildOrNull(data_index); //大抵はうまく整列しているので検索の手間を省く if (ch_data == null || ch_data.Name != ch_folder.Id) { dirty = true; ch_data = node.FindChild(ch_folder.Id); } else { data_index++; } if (ch_data == null) { ch_folder.ResetValue(); } else { ch_folder.LoadFrom(ch_data); } } else if (ch_item != null) { StructuredText.Entry ch_data = node.GetEntryOrNull(data_index); //大抵はうまく整列しているので検索の手間を省く if (ch_data == null || ch_data.name != ch_item.Id) { dirty = true; ch_data = node.FindEntry(ch_item.Id); } else { data_index++; } if (ch_data == null) { ch_item.ResetValue(); } else { ch_item.TryToParse(ch_data.value, PreferenceItem.ErrorMode.Reset); } } else if (ch_array != null) { ArrayList ch_data = new ArrayList(); StructuredText t = node.GetChildOrNull(data_index); if (t == null || t.Name != ch_array.Id) { dirty = true; ch_data.Clear(); ch_data.AddRange(node.FindMultipleNote(ch_array.Id)); } else //最初の一つが合格だったら継続して読み続ける { data_index++; while (t != null && t.Name == ch_array.Id) { ch_data.Add(t); t = node.GetChildOrNull(data_index++); } } ch_array.LoadFrom(ch_data); } else if (ch_loose != null) { //TODO これはFolderのときと同じだ。まとめよう StructuredText ch_data = node.GetChildOrNull(data_index); //大抵はうまく整列しているので検索の手間を省く if (ch_data == null || ch_data.Name != ch_loose.Id) { dirty = true; ch_data = node.FindChild(ch_loose.Id); } else { data_index++; } if (ch_data == null) { ch_loose.ResetValue(); } else { ch_loose.LoadFrom(ch_data); } } child_index++; //自分の子をステップ } //一度エラーなく読むことができていればdirtyはfalseのまま node.IsDirty = dirty; }
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; }