コード例 #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
ファイル: ProfileDialog.cs プロジェクト: MrJoe/lat
        void Init()
        {
            ui = new Glade.XML(null, "lat.glade", "profileDialog", null);
            ui.Autoconnect(this);

            Gdk.Pixbuf pb = Gdk.Pixbuf.LoadFromResource("x-directory-remote-server-48x48.png");
            image7.Pixbuf = pb;

            createCombo();
            noEncryptionRadioButton.Active = true;

            // views
            pluginStore = new ListStore(typeof(bool), typeof(string));

            CellRendererToggle crt = new CellRendererToggle();

            crt.Activatable = true;
            crt.Toggled    += OnClassToggled;

            pluginTreeView.AppendColumn("Enabled", crt, "active", 0);
            pluginTreeView.AppendColumn("Name", new CellRendererText(), "text", 1);

            pluginTreeView.Model = pluginStore;

            foreach (ViewPlugin vp in Global.Plugins.ServerViewPlugins)
            {
                if (conn.ServerViews.Contains(vp.GetType().ToString()))
                {
                    pluginStore.AppendValues(true, vp.Name);
                }
                else
                {
                    pluginStore.AppendValues(false, vp.Name);
                }
            }

            attrPluginStore = new ListStore(typeof(bool), typeof(string));

            crt             = new CellRendererToggle();
            crt.Activatable = true;
            crt.Toggled    += OnAttributeViewerToggled;

            attrViewPluginTreeView.AppendColumn("Enabled", crt, "active", 0);
            attrViewPluginTreeView.AppendColumn("Name", new CellRendererText(), "text", 1);

            attrViewPluginTreeView.Model = attrPluginStore;

            if (conn.AttributeViewers.Count == 0)
            {
                conn.SetDefaultAttributeViewers();
            }

            foreach (AttributeViewPlugin avp in Global.Plugins.AttributeViewPlugins)
            {
                if (conn.AttributeViewers.Contains(avp.GetType().ToString()))
                {
                    attrPluginStore.AppendValues(true, avp.Name);
                }
                else
                {
                    attrPluginStore.AppendValues(false, avp.Name);
                }
            }

            profileDialog.Icon = Global.latIcon;
        }