private bool IsUserMS(GitUser user) { if (user == null) { return(false); } if (!string.IsNullOrEmpty(user.Company) && ( string.Equals(user.Company.Trim(), "Microsoft", StringComparison.OrdinalIgnoreCase) || string.Equals(user.Company.Trim().Replace(" ", ""), "MicrosoftCorporation", StringComparison.OrdinalIgnoreCase) || string.Equals(user.Company.Trim().Replace(".", ""), "Microsoft", StringComparison.OrdinalIgnoreCase) ) ) { return(true); } if (!string.IsNullOrEmpty(user.Email) && user.Email.Contains("@microsoft.com")) { return(true); } return(false); }
private string GetUserMSType(GitUser user, bool isMS) { if (!isMS) { return(null); } // TODO return(MSTypeEnum.UnChecked.ToString().Replace("_", " ")); }
protected override object Extract() { if (SharedObject_Prod_GitHub == null) { return(null); } //[UserList, GitRepo-Contributor-mapping] List <object> ret = new List <object>(); List <GitHubRepository> repos = SharedObject_Prod_GitHub as List <GitHubRepository>; HashSet <string> usersDone = new HashSet <string>(); List <GitUser> userList = new List <GitUser>(); List <GitContributor> contributorList = new List <GitContributor>(); HashSet <string> contributorHS = new HashSet <string>(); foreach (GitHubRepository repo in repos) { List <GitContributor> contributors = Util.CallGitHubAPI <List <GitContributor> >(string.Format("https://api.github.com/repos/{0}/{1}/contributors", repo.Owner, repo.RepositoryName), repo.AuthToken) as List <GitContributor>; if (contributors == null) { continue; } foreach (var contributor in contributors) { contributor.GitRepoId = repo.PartitionKey; if (usersDone.Contains(contributor.Login)) { continue; } GitUser gitUser = Util.CallGitHubAPI <GitUser>(string.Format("https://api.github.com/users/{0}", contributor.Login), repo.AuthToken) as GitUser; if (gitUser == null) { continue; } usersDone.Add(contributor.Login); gitUser.Login = contributor.Login; userList.Add(gitUser); string tmpContributorKey = contributor.GitRepoId + "_" + contributor.Id; if (!contributorHS.Contains(tmpContributorKey)) { contributorList.Add(contributor); } contributorHS.Add(tmpContributorKey); } } ret.Add(userList); ret.Add(contributorList); return(ret); }