コード例 #1
0
ファイル: Util.cs プロジェクト: MrJoe/lat
        static Connection ParseV1Profile(XmlElement profileElement)
        {
            EncryptionType e            = EncryptionType.None;
            bool           savePassword = false;

            string encryption = profileElement.GetAttribute("encryption");

            if (encryption != null)
            {
                if (encryption.ToLower() == "ssl")
                {
                    e = EncryptionType.SSL;
                }
                else if (encryption.ToLower() == "tls")
                {
                    e = EncryptionType.TLS;
                }
            }

            string sp = profileElement.GetAttribute("save_password");

            if (sp != null)
            {
                try { savePassword = bool.Parse(sp); }
                catch { savePassword = false; }
            }

            ConnectionData data = new ConnectionData(
                profileElement.GetAttribute("name"),
                profileElement.GetAttribute("host"),
                int.Parse(profileElement.GetAttribute("port")),
                profileElement.GetAttribute("base"),
                profileElement.GetAttribute("user"),
                savePassword,
                e,
                Util.GetServerType(profileElement.GetAttribute("server_type")),
                false);

            Connection conn = new Connection(data);

            conn.SetDefaultAttributeViewers();
            conn.SetDefaultServerViews();

            return(conn);
        }
コード例 #2
0
        void AddViews(Connection conn, TreeIter profileIter)
        {
            if (conn == null)
            {
                Log.Error("Unable to add views to ViewsTreeView connection is null");
                return;
            }

            if (conn.ServerViews.Count == 0)
            {
                conn.SetDefaultServerViews();
            }

            foreach (ViewPlugin vp in Global.Plugins.ServerViewPlugins)
            {
                if (conn.ServerViews.Contains(vp.GetType().ToString()))
                {
                    viewsStore.AppendValues(profileIter, vp.Icon, vp.Name);
                }
            }
        }