예제 #1
0
 private void SwitchAccount(string accountName)
 {
     try
     {
         this.Account = SharpBucket.UsersEndPoint(accountName).GetProfile();
     }
     catch (BitbucketV2Exception e)
         when(e.HttpStatusCode == HttpStatusCode.NotFound)
         {
             // The given accountName do not seem to be a simple user, so try as a team
             this.Account = SharpBucket.TeamsEndPoint().TeamResource(accountName).GetProfile();
         }
 }
예제 #2
0
        private void SwitchAccount(string accountName)
        {
            try
            {
                this.Account = SharpBucket.UsersEndPoint(accountName).GetProfile();
            }
            catch (Exception)
            {
                this.Account = null;
            }

            // if account do not seem to be a simple user, try as a team
            if (this.Account?.username == null)
            {
                this.Account = SharpBucket.TeamsEndPoint().TeamResource(accountName).GetProfile();
            }
        }