示例#1
0
 public TreeNode(string name, NodeKind kind, Sha1 sha1)
     : this(name, sha1, kind)
 {
     if (string.IsNullOrWhiteSpace(name))
     {
         throw new ArgumentNullException(nameof(name));
     }
     if (!Enum.IsDefined(typeof(NodeKind), kind))
     {
         throw new ArgumentOutOfRangeException(nameof(kind));
     }
 }
示例#2
0
            public override int GetHashCode(Sha1 obj)
            {
                var hc = 17L;

                unchecked
                {
                    hc = (hc * 23) + (long)obj.Blit0;
                    hc = (hc * 23) + (long)obj.Blit1;
                    hc = (hc * 23) + obj.Blit2;
                }

                return(((int)(hc >> 32)) ^ (int)hc);
            }
示例#3
0
            public override int Compare(Sha1 x, Sha1 y)
            {
                // CLR returns [-1, 0, +1] for ulong/uint comparisons (vs arbitrary neg/pos values)

                var cmp = x.Blit0.CompareTo(y.Blit0);

                if (cmp != 0)
                {
                    return(cmp);
                }

                cmp = x.Blit1.CompareTo(y.Blit1);
                if (cmp != 0)
                {
                    return(cmp);
                }

                cmp = x.Blit2.CompareTo(y.Blit2);
                return(cmp);
            }
示例#4
0
 public void Deconstruct(out string name, out NodeKind kind, out Sha1 sha1)
 {
     name = Name;
     sha1 = Sha1;
     kind = Kind;
 }
示例#5
0
 public CommitId(Sha1 sha1)
 {
     Sha1 = sha1;
 }
示例#6
0
 public TreeId(Sha1 sha1)
 {
     Sha1 = sha1;
 }
示例#7
0
 public override bool Equals(Sha1 x, Sha1 y)
 => x.Blit0 == y.Blit0 &&
 x.Blit1 == y.Blit1 &&
 x.Blit2 == y.Blit2;
示例#8
0
 public BlobId(Sha1 sha1)
 {
     Sha1 = sha1;
 }