예제 #1
0
        /// <summary>
        /// Login the specified username and password.
        /// </summary>
        /// <param name="username">Username.</param>
        /// <param name="password">Password.</param>
        protected Account Login(string username, string password)
        {
            var client = new GitHubSharp.Client(username, password);
            var user   = client.API.GetAuthenticatedUser();

            return(new Account {
                Username = username, Password = password, AvatarUrl = user.Data.AvatarUrl
            });
        }
예제 #2
0
        public static void SetUser(Account account)
        {
            if (account == null)
            {
                Account = null;
                Client = null;
                Accounts.SetDefault(null);
                return;
            }

            Account = account;
            Accounts.SetDefault(Account);

            Client = new GitHubSharp.Client(Account.Username, Account.Password) {
                Timeout = 1000 * 30, //30 seconds
                CacheProvider = Cache,
            }; 
        }
예제 #3
0
        public static void SetUser(Account account)
        {
            if (account == null)
            {
                Account = null;
                Client  = null;
                Accounts.SetDefault(null);
                return;
            }

            Account = account;
            Accounts.SetDefault(Account);

            Client = new GitHubSharp.Client(Account.Username, Account.Password)
            {
                Timeout       = 1000 * 30, //30 seconds
                CacheProvider = Cache,
            };
        }
예제 #4
0
        public static void SetUser(GitHubAccount account, GitHubSharp.Client client)
        {
            if (account == null)
            {
                Account = null;
                Client  = null;
                Accounts.SetDefault(null);
                return;
            }

            Accounts.SetActiveAccount(account);
            Accounts.SetDefault(account);

            //Assign the client
            Client         = client;
            Client.Timeout = 1000 * 30;

            CheckCacheSize(account.Cache);

            //Set the cache
            ClientCache  = account.Cache;
            Client.Cache = new GitHubCache(account.Cache);
        }
예제 #5
0
		/// <summary>
		/// Login the specified username and password.
		/// </summary>
		/// <param name="username">Username.</param>
		/// <param name="password">Password.</param>
		protected Account Login(string username, string password)
		{
			var client = new GitHubSharp.Client(username, password);
			var user = client.API.GetAuthenticatedUser();
			return new Account { Username = username, Password = password, AvatarUrl = user.Data.AvatarUrl };
		}