• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# StructuredText类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中StructuredText的典型用法代码示例。如果您正苦于以下问题:C# StructuredText类的具体用法?C# StructuredText怎么用?C# StructuredText使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



StructuredText类属于命名空间,在下文中一共展示了StructuredText类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: Serialize

 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;
 }
开发者ID:FNKGino,项目名称:poderosa,代码行数:25,代码来源:RenderProfileSerialize.cs


示例2: ConstructorWithTextInitializesProperties

        public void ConstructorWithTextInitializesProperties()
        {
            StructuredText text = new StructuredText("blah");
            Assert.Count(0, text.Attachments);

            Assert.AreEqual(new BodyTag() { Contents = { new TextTag("blah") } }, text.BodyTag);
        }
开发者ID:dougrathbone,项目名称:mbunit-v3,代码行数:7,代码来源:StructuredTextTest.cs


示例3: Deserialize

        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;
        }
开发者ID:FNKGino,项目名称:poderosa,代码行数:25,代码来源:RenderProfileSerialize.cs


示例4: Serialize

        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;
        }
开发者ID:Ricordanza,项目名称:poderosa,代码行数:26,代码来源:TerminalSettingsSerialize.cs


示例5: Deserialize

 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);
 }
开发者ID:poderosaproject,项目名称:poderosa,代码行数:7,代码来源:TerminalParameterSerialize.cs


示例6: Serialize

        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;
        }
开发者ID:Ricordanza,项目名称:poderosa,代码行数:35,代码来源:PipeTerminalParameterSerializer.cs


示例7: Deserialize

        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;
        }
开发者ID:Ricordanza,项目名称:poderosa,代码行数:9,代码来源:Serialize.cs


示例8: Serialize

        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;
        }
开发者ID:Ricordanza,项目名称:poderosa,代码行数:9,代码来源:PipeTerminalSettingsSerializer.cs


示例9: Serialize

 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);
 }
开发者ID:poderosaproject,项目名称:poderosa,代码行数:10,代码来源:TerminalParameterSerialize.cs


示例10: Deserialize

        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;
        }
开发者ID:Ricordanza,项目名称:poderosa,代码行数:12,代码来源:PipeTerminalSettingsSerializer.cs


示例11: SaveToXML

        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();

        }
开发者ID:Ricordanza,项目名称:poderosa,代码行数:16,代码来源:ShortcutFile.cs


示例12: Deserialize

        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;
        }
开发者ID:Ricordanza,项目名称:poderosa,代码行数:20,代码来源:PipeTerminalParameterSerializer.cs


示例13: Deserialize

        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;
        }
开发者ID:Ricordanza,项目名称:poderosa,代码行数:23,代码来源:TerminalSettingsSerialize.cs


示例14: Deserialize

        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;
        }
开发者ID:Ricordanza,项目名称:poderosa,代码行数:18,代码来源:SerialSettings.cs


示例15: Serialize

        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;
        }
开发者ID:Ricordanza,项目名称:poderosa,代码行数:23,代码来源:SerialSettings.cs


示例16: Dump

 private string Dump(StructuredText node)
 {
     StringWriter w = new StringWriter();
     new TextStructuredTextWriter(w).Write(node);
     w.Close();
     return w.ToString();
 }
开发者ID:FNKGino,项目名称:poderosa,代码行数:7,代码来源:PreferencesT.cs


示例17: BuildPreference

        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;
        }
开发者ID:Ricordanza,项目名称:poderosa,代码行数:17,代码来源:PoderosaStartup.cs


示例18: CreatePoderosaApplication

 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;
 }
开发者ID:Ricordanza,项目名称:poderosa,代码行数:5,代码来源:PoderosaStartup.cs


示例19: InitPreference

        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();
        }
开发者ID:FNKGino,项目名称:poderosa,代码行数:8,代码来源:PreferencesT.cs


示例20: PoderosaStartupContext

 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);
 }
开发者ID:Ricordanza,项目名称:poderosa,代码行数:11,代码来源:PoderosaStartup.cs



注:本文中的StructuredText类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# StubFolders类代码示例发布时间:2022-05-24
下一篇:
C# StructureType类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap