//ファイルシステムを読んで作成
        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);
        }
예제 #2
0
        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));
                }
            }
        }
예제 #3
0
        public StructuredText Serialize(object obj)
        {
            MRUItem        item = (MRUItem)obj;
            StructuredText t    = new StructuredText(this.ConcreteType.FullName);

            t.AddChild(_serializeService.Serialize(item.TerminalParameter));
            t.AddChild(_serializeService.Serialize(item.TerminalSettings));
            return(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;
        }
예제 #5
0
        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 void AddAssembly(string home, string[] filenames)
 {
     foreach (string f in filenames)
     {
         _data.AddChild(Path.Combine(home, f));
     }
 }
        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;
        }
예제 #8
0
 internal void SaveTo(StructuredText parent)
 {
     foreach (PreferenceFolder f in _folders)
     {
         StructuredText ch = parent.AddChild(_id);
         f.SaveTo(ch);
     }
 }
        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;
        }
예제 #10
0
        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();
        }
예제 #11
0
 public void SaveTo(StructuredText node)
 {
     foreach (MRUItem tp in _data)
     {
         try {
             node.AddChild(_serializer.Serialize(tp));
         }
         catch (Exception ex) {
             RuntimeUtil.ReportException(ex);
         }
     }
 }
        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);
                    }
                }
            }

            node.Set("enableAgentForwarding", tp.EnableAgentForwarding.ToString());

            node.Set("enableX11Forwarding", tp.EnableX11Forwarding.ToString());

            if (tp.X11Forwarding != null)
            {
                StructuredText x11Node = node.AddChild("x11Forwarding");
                x11Node.Set("display", tp.X11Forwarding.Display.ToString(NumberFormatInfo.InvariantInfo));
                x11Node.Set("screen", tp.X11Forwarding.Screen.ToString(NumberFormatInfo.InvariantInfo));
                x11Node.Set("needAuth", tp.X11Forwarding.NeedAuth.ToString());
                if (tp.X11Forwarding.XauthorityFile != null)
                {
                    x11Node.Set("xauthorityFile", tp.X11Forwarding.XauthorityFile);
                }
                x11Node.Set("useCygwinUnixDomainSocket", tp.X11Forwarding.UseCygwinUnixDomainSocket.ToString());
                if (tp.X11Forwarding.X11UnixFolder != null)
                {
                    x11Node.Set("x11UnixFolder", tp.X11Forwarding.X11UnixFolder);
                }
            }
        }
예제 #13
0
 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();
 }
예제 #14
0
        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);
        }
예제 #15
0
        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);
        }
예제 #16
0
        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);
        }
예제 #17
0
 public void SaveTo(StructuredText node) {
     foreach (MRUItem tp in _data) {
         try {
             node.AddChild(_serializer.Serialize(tp));
         }
         catch (Exception ex) {
             RuntimeUtil.ReportException(ex);
         }
     }
 }
예제 #18
0
        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 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);
                    }
                }
            }

            node.Set("enableAgentForwarding", tp.EnableAgentForwarding.ToString());

            node.Set("enableX11Forwarding", tp.EnableX11Forwarding.ToString());

            if (tp.X11Forwarding != null) {
                StructuredText x11Node = node.AddChild("x11Forwarding");
                x11Node.Set("display", tp.X11Forwarding.Display.ToString(NumberFormatInfo.InvariantInfo));
                x11Node.Set("screen", tp.X11Forwarding.Screen.ToString(NumberFormatInfo.InvariantInfo));
                x11Node.Set("needAuth", tp.X11Forwarding.NeedAuth.ToString());
                if (tp.X11Forwarding.XauthorityFile != null) {
                    x11Node.Set("xauthorityFile", tp.X11Forwarding.XauthorityFile);
                }
                x11Node.Set("useCygwinUnixDomainSocket", tp.X11Forwarding.UseCygwinUnixDomainSocket.ToString());
                if (tp.X11Forwarding.X11UnixFolder != null) {
                    x11Node.Set("x11UnixFolder", tp.X11Forwarding.X11UnixFolder);
                }
            }
        }
예제 #20
0
 public StructuredText Serialize(object obj) {
     MRUItem item = (MRUItem)obj;
     StructuredText t = new StructuredText(this.ConcreteType.FullName);
     t.AddChild(_serializeService.Serialize(item.TerminalParameter));
     t.AddChild(_serializeService.Serialize(item.TerminalSettings));
     return t;
 }