コード例 #1
0
        public static Configuration Read()
        {
            Configuration cfg = new Configuration();
            RegistryKey key = Registry.CurrentUser.OpenSubKey( @"Software\Teamfound", true );
            if ( key == null )
                return cfg;

            cfg.servers.Clear();

            string[] keyNames = key.GetSubKeyNames();
            foreach (string name in keyNames)
            {
                if (!name.StartsWith("server"))
                    continue;

                RegistryKey temp = key.OpenSubKey(name);

                Server server = new Server();
                server.Url = temp.GetValue("url").ToString();
                server.User = temp.GetValue("user").ToString();
                server.Password = temp.GetValue("password").ToString();

                cfg.servers.Add(server);
            }
            key.Close();
            return cfg;
        }
コード例 #2
0
 public void AddServer(Server server)
 {
     servers.Add(server);
 }
コード例 #3
0
        /// <summary>
        /// command = login
        /// user = hans
        /// pass = qwerty
        /// uniforgeuser = yes/no 
        /// </summary>
        /// <param name="p"></param>
        /// <param name="p_2"></param>
        internal void Login(Server server)
        {
            string url = GetBaseUrl(server,"login") +
                string.Format("&user={0}&pass={1}",server.User, server.Password);

            XmlDocument doc = SendRequest(url);

            if (!CheckResult(doc))
                return;

            if (this.server != null)
                Logout();

            this.server = server;

            isLoggedIn = true;
            project = null;
            projects = null;
            users = null;

            if (LoggedIn != null)
                LoggedIn(this, new EventArgs());
        }
コード例 #4
0
        private string GetBaseUrl(Server server, string command)
        {
            string url = server.Url +
                string.Format("?want=xml&version={0}&command={1}", version, command);

            return url;
        }
コード例 #5
0
        public void AddServer(string url, string user, string password)
        {
            Server server = new Server();
            server.Url = url;
            server.User = user;
            server.Password = password;

            config.AddServer(server);
            config.Write();

            if (ServersChanged != null)
                ServersChanged(this, new EventArgs());
        }