コード例 #1
0
 public static string GenerateCommiterName(this CommitModel x)
 {
     if (x.Commit.Author != null && !string.IsNullOrEmpty(x.Commit.Author.Name))
     {
         return(x.Commit.Author.Name);
     }
     if (x.Commit.Committer != null && !string.IsNullOrEmpty(x.Commit.Committer.Name))
     {
         return(x.Commit.Committer.Name);
     }
     if (x.Author != null)
     {
         return(x.Author.Login);
     }
     return(x.Committer != null ? x.Committer.Login : "******");
 }
コード例 #2
0
ファイル: CommitModel.cs プロジェクト: thedillonb/GitHubSharp
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, obj))
            {
                return(true);
            }
            if (obj.GetType() != typeof(CommitModel))
            {
                return(false);
            }
            CommitModel other = (CommitModel)obj;

            return(Url == other.Url && HtmlUrl == other.HtmlUrl && CommentsUrl == other.CommentsUrl && Sha == other.Sha && Commit == other.Commit && Author == other.Author && Committer == other.Committer && Parents == other.Parents && Stats == other.Stats && Files == other.Files);
        }
コード例 #3
0
 public static string GenerateGravatarUrl(this CommitModel x)
 {
     try
     {
         var inputBytes = Encoding.ASCII.GetBytes(x.Commit.Author.Email.Trim().ToLower());
         var hash       = MD5.Create().ComputeHash(inputBytes);
         var sb         = new StringBuilder();
         for (int i = 0; i < hash.Length; i++)
         {
             sb.Append(hash[i].ToString("x2"));
         }
         return(string.Format("http://www.gravatar.com/avatar/{0}?d={1}", sb, GitHubDefaultGravitar));
     }
     catch
     {
         return(null);
     }
 }