public override object Deserialize(StructuredText node) { TelnetParameter t = new TelnetParameter(); base.Deserialize(t, node); return(t); }
private static void WriteTruncated(MarkupStreamWriter writer, StructuredText text, int maxLength) { if (text.TruncatedWriteTo(writer, maxLength)) { writer.WriteEllipsis(); } }
public void ConstructorWithBodyTagAndAttachmentsInitializesProperties() { StructuredText text = new StructuredText(Example.BodyTag, Example.Attachments); Assert.AreEqual(Example.BodyTag, text.BodyTag); Assert.AreEqual(Example.Attachments, text.Attachments); }
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 override object Deserialize(StructuredText node) { SSHLoginParameter t = new SSHLoginParameter(); Deserialize(t, node); return(t); }
public void Serialize(TerminalParameter tp, StructuredText node) { if (tp.TerminalType != TerminalParameter.DEFAULT_TERMINAL_TYPE) node.Set("terminal-type", tp.TerminalType); if (tp.AutoExecMacroPath != null) node.Set("autoexec-macro", tp.AutoExecMacroPath); }
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 Serialize(TCPParameter tp, StructuredText node) { base.Serialize(tp, node); node.Set("destination", tp.Destination); if (tp.Port != _defaultPort) node.Set("port", tp.Port.ToString()); }
public override StructuredText Serialize(object obj) { StructuredText node = new StructuredText(this.ConcreteType.FullName); base.Serialize((TCPParameter)obj, node); node.Set("telnetNewLine", ((TelnetParameter)obj).TelnetNewLine.ToString()); return node; }
private void List(PluginManifest manifest) { _allPlugins = new List <Plugin>(); foreach (object asm_def_ in manifest.Children) { StructuredText asm_def = asm_def_ as StructuredText; if (asm_def == null) { continue; //エラーハンドリングやや甘 } string asm_name = asm_def.Name; PluginManifest.AssemblyNode asmnode = null; try { asmnode = manifest.LoadAssemblyNode(asm_def); } catch (Exception) { _tracer.Trace("PluginManager.Messages.AssemblyLoadError", asm_name); continue; } asmnode.TryToBind(_tracer); foreach (Type t in asmnode.PluginTypes) { _allPlugins.Add(new Plugin(this, asmnode.Assembly, t)); } } }
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; }
/// <summary> /// Semantic Size of the Text /// </summary> public async Task <decimal> SSOTT(StructuredText text) { var terms = text.Terms.Distinct(new TermComparer()).ToList(); var otherTerms = terms.ToList(); var Re = 0m; foreach (var from in terms) { otherTerms.Remove(from); foreach (var to in otherTerms) { Re += await SDIT(from.Id, to.Id, text); } } if (Re == 0) { return(0); } //var R = 1m / Re; return(Re); }
public StructuredText Serialize(object obj) { StructuredText storage = new StructuredText(typeof(RenderProfile).FullName); RenderProfile prof = (RenderProfile)obj; storage.Set("font-name", prof.FontName); storage.Set("cjk-font-name", prof.CJKFontName); storage.Set("font-size", prof.FontSize.ToString()); storage.Set("line-spacing", prof.LineSpacing.ToString()); if (prof.UseClearType) { storage.Set("clear-type", "true"); } if (!prof.EnableBoldStyle) { storage.Set("enable-bold-style", "false"); } if (prof.ForceBoldStyle) { storage.Set("force-bold-style", "true"); } storage.Set("text-color", prof.ForeColor.Name); storage.Set("back-color", prof.BackColor.Name); if (prof.BackgroundImageFileName.Length > 0) { storage.Set("back-image", prof.BackgroundImageFileName); storage.Set("back-style", prof.ImageStyle.ToString()); } if (!prof.ESColorSet.IsDefault) { storage.Set("escape-sequence-color", prof.ESColorSet.Format()); } storage.Set("darken-escolor-for-background", prof.DarkenEsColorForBackground.ToString()); return(storage); }
public void TestAppendUtf8PlainTextFile_Html() { var fileName = Path.Combine(FileHelper.GetAppPath(), "Resources\\HelpFile.txt"); var sr = new StructuredText(); sr.AddHeader1("Überschrift 1"); sr.AddParagraph(MassText); sr.AddDefinitionListLine("Def1", "Value1"); sr.AddDefinitionListLine("Definition 2", "Value1234"); sr.AddDefinitionListLine("Defini 3", "Value234556666"); sr.AppendUtf8PlainTextFile(fileName); sr.AddHeader1("Überschrift 1"); sr.AddParagraph(MassText); sr.AddParagraph(MassText); var f = new HtmlTextFormatter { StructuredText = sr, Template = "<<<Start>>>{0}<<<Ende>>>", AddTableOfContent = true }; var result = f.GetFormattedText(); Debug.Print(result); Assert.IsTrue(!string.IsNullOrEmpty(result)); }
public StructuredText Serialize(object obj) { PipeTerminalParameter tp = obj as PipeTerminalParameter; Debug.Assert(tp != null); StructuredText node = new StructuredText(ConcreteType.FullName); if (tp.ExeFilePath != null) node.Set("exeFilePath", tp.ExeFilePath); if (!String.IsNullOrEmpty(tp.CommandLineOptions)) node.Set("commandLineOptions", tp.CommandLineOptions); if (tp.EnvironmentVariables != null && tp.EnvironmentVariables.Length > 0) { foreach (PipeTerminalParameter.EnvironmentVariable e in tp.EnvironmentVariables) { StructuredText envNode = new StructuredText("environmentVariable"); envNode.Set("name", e.Name); envNode.Set("value", e.Value); node.AddChild(envNode); } } if (tp.InputPipePath != null) node.Set("inputPipePath", tp.InputPipePath); if (tp.OutputPipePath != null) node.Set("outputPipePath", tp.OutputPipePath); if (tp.TerminalType != null) node.Set("terminal-type", tp.TerminalType); if (tp.AutoExecMacroPath != null) node.Set("autoexec-macro", tp.AutoExecMacroPath); return node; }
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 static PluginManifest CreateByText(string text) { PluginManifest m = new PluginManifest(); StructuredText s = new TextStructuredTextReader(new StringReader(text)).Read(); if (s.Name == "manifest") { foreach (object manifestChild in s.Children) { StructuredText assemblyEntryNode = manifestChild as StructuredText; if (assemblyEntryNode != null) { PluginManifest.AssemblyEntry entry = m.AddAssembly(assemblyEntryNode.Name); foreach (object assemblyEntryChild in assemblyEntryNode.Children) { StructuredText.Entry pluginEntry = assemblyEntryChild as StructuredText.Entry; if (pluginEntry != null && pluginEntry.name == "plugin") { entry.AddPluginType(pluginEntry.value); } } } } } return(m); }
public override StructuredText Serialize(object obj) { StructuredText t = new StructuredText(this.ConcreteType.FullName); Serialize((LocalShellParameter)obj, t); return(t); }
internal void SaveTo(StructuredText node) { node.Clear(); foreach (PreferenceItemBase t in _children) { PreferenceFolder ch_folder = t as PreferenceFolder; PreferenceFolderArray ch_array = t as PreferenceFolderArray; PreferenceItem ch_item = t as PreferenceItem; PreferenceLooseNode ch_loose = t as PreferenceLooseNode; if (ch_folder != null) { StructuredText ch = node.AddChild(ch_folder.Id); ch_folder.SaveTo(ch); } else if (ch_item != null) //item { if (ch_item.IsChanged) //デフォルト値と変わっていた場合のみ記録 { node.Set(ch_item.Id, ch_item.FormatValue()); } } else if (ch_array != null) // array { ch_array.SaveTo(node); } else if (ch_loose != null) { ch_loose.SaveTo(node.AddChild(ch_loose.Id)); } } }
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 Test1() { RenderProfile prof1 = new RenderProfile(); prof1.FontName = "console"; prof1.JapaneseFontName = "MS ゴシック"; prof1.UseClearType = true; prof1.FontSize = 12; prof1.BackColor = Color.FromKnownColor(KnownColor.Yellow); prof1.ForeColor = Color.FromKnownColor(KnownColor.White); prof1.BackgroundImageFileName = "image-file"; prof1.ImageStyle = ImageStyle.Scaled; prof1.ESColorSet = new EscapesequenceColorSet(); prof1.ESColorSet[1] = Color.Pink; StructuredText storage = _renderProfileSerializer.Serialize(prof1); //確認 StringWriter wr = new StringWriter(); new TextStructuredTextWriter(wr).Write(storage); wr.Close(); Debug.WriteLine(wr.ToString()); RenderProfile prof2 = (RenderProfile)_renderProfileSerializer.Deserialize(storage); Assert.AreEqual(prof1.FontName, prof2.FontName); Assert.AreEqual(prof1.JapaneseFontName, prof2.JapaneseFontName); Assert.AreEqual(prof1.UseClearType, prof2.UseClearType); Assert.AreEqual(prof1.FontSize, prof2.FontSize); Assert.AreEqual(prof1.BackColor.Name, prof2.BackColor.Name); Assert.AreEqual(prof1.ForeColor.Name, prof2.ForeColor.Name); Assert.AreEqual(prof1.BackgroundImageFileName, prof2.BackgroundImageFileName); Assert.AreEqual(prof1.ImageStyle, prof2.ImageStyle); Assert.AreEqual(prof1.ESColorSet.Format(), prof2.ESColorSet.Format()); }
public void Serialize(SSHLoginParameter tp, StructuredText node) { base.Serialize(tp, node); if (tp.Method != SSHProtocol.SSH2) { node.Set("method", tp.Method.ToString()); } if (tp.AuthenticationType != AuthenticationType.Password) { node.Set("authentication", tp.AuthenticationType.ToString()); } node.Set("account", tp.Account); if (tp.IdentityFileName.Length > 0) { node.Set("identityFileName", tp.IdentityFileName); } if (tp.PasswordOrPassphrase != null) { if (ProtocolsPlugin.Instance.ProtocolOptions.SavePlainTextPassword) { node.Set("passphrase", tp.PasswordOrPassphrase); } else if (ProtocolsPlugin.Instance.ProtocolOptions.SavePassword) { string pw = new SimpleStringEncrypt().EncryptString(tp.PasswordOrPassphrase); if (pw != null) { node.Set("password", pw); } } } }
public StructuredText Serialize(object obj) { StructuredText storage = new StructuredText(typeof(RenderProfile).FullName); RenderProfile prof = (RenderProfile)obj; storage.Set("font-name", prof.FontName); storage.Set("cjk-font-name", prof.CJKFontName); storage.Set("font-size", prof.FontSize.ToString()); storage.Set("line-spacing", prof.LineSpacing.ToString()); if (prof.UseClearType) storage.Set("clear-type", "true"); if (!prof.EnableBoldStyle) storage.Set("enable-bold-style", "false"); if (prof.ForceBoldStyle) storage.Set("force-bold-style", "true"); storage.Set("text-color", prof.ForeColor.Name); storage.Set("back-color", prof.BackColor.Name); if (prof.BackgroundImageFileName.Length > 0) { storage.Set("back-image", prof.BackgroundImageFileName); storage.Set("back-style", prof.ImageStyle.ToString()); } if (!prof.ESColorSet.IsDefault) storage.Set("escape-sequence-color", prof.ESColorSet.Format()); storage.Set("darken-escolor-for-background", prof.DarkenEsColorForBackground.ToString()); return storage; }
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 static PluginManifest CreateByFileSystem(string base_dir) { PluginManifest m = new PluginManifest(); StructuredText st = new StructuredText("manifest"); //自分のディレクトリにある.dllを検索。アプリケーション版では不要だが、開発時のデバッグ実行時には必要 string[] dlls = Directory.GetFiles(base_dir, "*.dll"); foreach (string dll in dlls) { st.AddChild(dll); } //子ディレクトリ直下のみ検索。 string[] dirs = Directory.GetDirectories(base_dir); foreach (string dir in dirs) { dlls = Directory.GetFiles(dir, "*.dll"); foreach (string dll in dlls) { st.AddChild(dll); } } m._data = st; return(m); }
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 TestAppendUtf8PlainTextFile_Text() { var fileName = Path.Combine(FileHelper.GetAppPath(), "Resources\\HelpFile.txt"); var sr = new StructuredText(); sr.AddHeader1("Überschrift 1"); sr.AddParagraph(MassText); sr.AddDefinitionListLine("Def1", "Value1"); sr.AddDefinitionListLine("Definition 2", "Value1234"); sr.AddDefinitionListLine("Defini 3", "Value234556666"); sr.AddDefinitionListLine("Defini 4", null); sr.AppendUtf8PlainTextFile(fileName); sr.AddHeader1("Überschrift 1"); sr.AddParagraph(MassText); sr.AddParagraph(MassText); var f = new PlainTextFormatter { StructuredText = sr, }; var result = f.GetFormattedText(); Debug.Print(result); Assert.IsTrue(!string.IsNullOrEmpty(result)); }
public void ConstructorWithTextInitializesProperties() { StructuredText text = new StructuredText("blah"); Assert.Count(0, text.Attachments); Assert.AreEqual(new BodyTag() { Contents = { new TextTag("blah") } }, text.BodyTag); }
public override object Deserialize(StructuredText node) { LocalShellParameter t = new LocalShellParameter(); Deserialize(t, node); return(t); }
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 TestGetFormattedText_WithTable() { var sr = new StructuredText(); sr.AddHeader1("Überschrift 1"); sr.AddTable("Tabellentitel", DataHelper.GetData()); sr.AddHeader1("Überschrift 2"); sr.AddParagraph(MassText); sr.AddParagraph(MassText); sr.AddParagraph(MassText); sr.AddDefinitionListLine("Def1", "Value1"); sr.AddDefinitionListLine("Definition 2", "Value1234"); sr.AddDefinitionListLine("Defini 3", "Value234556666"); sr.AddParagraph(""); sr.AddParagraph(MassText); sr.AddListItem("Bahnhof"); sr.AddListItem("HauptBahnhof"); sr.AddListItem("SüdBahnhof"); sr.AddHeader1("Überschrift 2"); sr.AddParagraph(MassText); sr.AddParagraph(MassText); sr.AddTable("Tabellentitel", DataHelper.GetData()); sr.AddHeader1("Überschrift 2"); sr.AddParagraph(MassText); sr.AddHeader1("Überschrift 1"); sr.AddParagraph(MassText); sr.AddParagraph(MassText); sr.AddParagraph(MassText); sr.AddHeader1("Überschrift 2"); sr.AddParagraph(MassText); sr.AddParagraph(MassText); sr.AddParagraph(MassText); sr.AddParagraph(MassText); sr.AddHeader1("Überschrift 2"); sr.AddParagraph(MassText); sr.AddHeader1("Überschrift 1"); sr.AddParagraph(MassText); sr.AddParagraph(MassText); var f = new PlainTextFormatter { StructuredText = sr, Template = "<<<Start>>>{0}<<<Ende>>>" }; var result = f.GetFormattedText(); Debug.Print(result); Assert.IsTrue(!string.IsNullOrEmpty(result)); }
internal void SaveTo(StructuredText parent) { foreach (PreferenceFolder f in _folders) { StructuredText ch = parent.AddChild(_id); f.SaveTo(ch); } }
public static string DumpStructuredText(StructuredText st) { StringWriter wr = new StringWriter(); new TextStructuredTextWriter(wr).Write(st); wr.Close(); return(wr.ToString()); }
private void InitPreference(IPreferenceSupplier s, string expr) { _testSupplier = s; _rootNote = expr == null?CreateRoot() : CreateRoot(expr); _poderosaApplication = PoderosaStartup.CreatePoderosaApplication(CreatePluginManifest(), new StructuredText(null, "Poderosa").AddChild(_rootNote)); _poderosaApplication.Start(); }
private string Dump(StructuredText node) { StringWriter w = new StringWriter(); new TextStructuredTextWriter(w).Write(node); w.Close(); return(w.ToString()); }
public StructuredText Serialize(object obj) { PipeTerminalSettings ts = obj as PipeTerminalSettings; Debug.Assert(ts != null); StructuredText node = new StructuredText(this.ConcreteType.FullName); node.AddChild(PipePlugin.Instance.SerializeService.Serialize(typeof(TerminalSettings), obj)); return node; }
public object Deserialize(StructuredText node) { ISerializeServiceElement se = FindServiceElement(node.Name); if (se == null) throw new ArgumentException("ISerializeServiceElement is not found for the tag " + node.Name); object t = se.Deserialize(node); Debug.Assert(t.GetType() == se.ConcreteType); return t; }
public void Serialize(LocalShellParameter tp, StructuredText node) { base.Serialize(tp, node); if (CygwinUtil.DefaultHome != tp.Home) node.Set("home", tp.Home); if (CygwinUtil.DefaultShell != tp.ShellName) node.Set("shellName", tp.ShellName); if (CygwinUtil.DefaultCygwinDir != tp.CygwinDir) node.Set("cygwin-directory", tp.CygwinDir); }
public object Deserialize(StructuredText node) { PipeTerminalSettings ts = new PipeTerminalSettings(); StructuredText baseNode = node.GetChildOrNull(0); if (baseNode != null) { TerminalSettings baseTs = PipePlugin.Instance.SerializeService.Deserialize(baseNode) as TerminalSettings; if (baseTs != null) { ts.Import(baseTs); } } return ts; }
public void SaveToXML(string filename) { ISerializeService ss = TerminalSessionsPlugin.Instance.SerializeService; StructuredText settings_text = ss.Serialize(_settings); StructuredText parameter_text = ss.Serialize(_param); //新形式で StructuredText root = new StructuredText("poderosa-shortcut"); root.Set("version", "4.0"); root.AddChild(settings_text); root.AddChild(parameter_text); XmlWriter wr = CreateDefaultWriter(filename); new XmlStructuredTextWriter(wr).Write(root); wr.WriteEndDocument(); wr.Close(); }
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) { 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 StructuredText Serialize(object obj) { SerialTerminalSettings ts = obj as SerialTerminalSettings; Debug.Assert(ts != null); StructuredText node = new StructuredText(this.ConcreteType.FullName); node.AddChild(SerialPortPlugin.Instance.SerializeService.Serialize(typeof(TerminalSettings), ts)); node.Set("baud-rate", ts.BaudRate.ToString()); if (ts.ByteSize != 8) node.Set("byte-size", ts.ByteSize.ToString()); if (ts.Parity != Parity.NOPARITY) node.Set("parity", ts.Parity.ToString()); if (ts.StopBits != StopBits.ONESTOPBIT) node.Set("stop-bits", ts.StopBits.ToString()); if (ts.FlowControl != FlowControl.None) node.Set("flow-control", ts.FlowControl.ToString()); if (ts.TransmitDelayPerChar != 0) node.Set("delay-per-char", ts.TransmitDelayPerChar.ToString()); if (ts.TransmitDelayPerLine != 0) node.Set("delay-per-line", ts.TransmitDelayPerLine.ToString()); return node; }
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) { LocalShellParameter t = new LocalShellParameter(); Deserialize(t, node); return t; }
public override StructuredText Serialize(object obj) { StructuredText t = new StructuredText(this.ConcreteType.FullName); Serialize((LocalShellParameter)obj, t); return t; }
private static StructuredText BuildPreference(string preference_file) { //TODO 例外時などどこか適当に通知が必要 StructuredText pref = null; if (File.Exists(preference_file)) { using (TextReader r = new StreamReader(preference_file, Encoding.Default)) { pref = new TextStructuredTextReader(r).Read(); } // Note: // if the file is empty or consists of empty lines, // pref will be null. } if (pref == null) pref = new StructuredText("Poderosa"); return pref; }
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 abstract object Deserialize(StructuredText node);
public PoderosaStartupContext(PluginManifest pluginManifest, string home_directory, string profile_home, string[] args, string open_file) { _instance = this; _homeDirectory = AdjustDirectory(home_directory); _profileHomeDirectory = AdjustDirectory(profile_home); _initialOpenFile = open_file; _args = args; Debug.Assert(pluginManifest != null); _pluginManifest = pluginManifest; _preferenceFileName = Path.Combine(_profileHomeDirectory, "options.conf"); _preferences = BuildPreference(_preferenceFileName); }
public PoderosaStartupContext(PluginManifest pluginManifest, string home_directory, StructuredText preference, string[] args, string open_file) { _instance = this; _homeDirectory = AdjustDirectory(home_directory); _profileHomeDirectory = _homeDirectory; _initialOpenFile = open_file; _args = args; Debug.Assert(pluginManifest != null); _pluginManifest = pluginManifest; Debug.Assert(preference != null); _preferenceFileName = null; _preferences = preference; }
private string Dump(StructuredText node) { StringWriter w = new StringWriter(); new TextStructuredTextWriter(w).Write(node); w.Close(); return w.ToString(); }
public static IPoderosaApplication CreatePoderosaApplication(string plugin_manifest, StructuredText preference, string[] args) { string home_directory = Directory.GetCurrentDirectory(); InternalPoderosaWorld w = new InternalPoderosaWorld(new PoderosaStartupContext(PluginManifest.CreateByText(plugin_manifest), home_directory, preference, args, null)); return w; }
public StructuredText Serialize(object obj) { SerialTerminalParam tp = obj as SerialTerminalParam; Debug.Assert(tp != null); StructuredText node = new StructuredText(this.ConcreteType.FullName); node.Set("PortName", tp.PortName); if (tp.TerminalType != "vt100") node.Set("TerminalType", tp.TerminalType); if (tp.AutoExecMacroPath != null) node.Set("autoexec-macro", tp.AutoExecMacroPath); return node; }
private void InitPreference(IPreferenceSupplier s, string expr) { _testSupplier = s; _rootNote = expr == null ? CreateRoot() : CreateRoot(expr); _poderosaApplication = PoderosaStartup.CreatePoderosaApplication(CreatePluginManifest(), new StructuredText(null, "Poderosa").AddChild(_rootNote)); _poderosaApplication.Start(); }