Example #1
0
        //文字列形式から作成
        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);
        }
Example #2
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);
        }
Example #3
0
        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);
        }
Example #4
0
        //文字列形式から作成
        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;
        }
Example #5
0
        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 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);
        }