Esempio n. 1
0
 public bool Equals(CopyItem obj)
 {
     if (this.Formats.OrderBy(i => i).SequenceEqual(obj.Formats.OrderBy(i => i)))
     {
         foreach (var f in this.Formats)
         {
             if (f != "EnhancedMetafile" && f != "HTML Format")
             {
                 var one = this.Item.GetData(f).ToString();
                 var two = obj.Item.GetData(f).ToString();
                 if (!one.Equals(two))
                 {
                     return(false);
                 }
             }
         }
         return(true);
         //var one = GetHash(this);
         //var two = GetHash(obj);
         //if (GetHash(this) == GetHash(obj))
         //    return true;
         //else return false;
     }
     return(false);
 }
Esempio n. 2
0
        private int GetHash(CopyItem ci)
        {
            var hashcode = 0;

            if (ci.Formats.Contains("FileDrop"))
            {
                foreach (String i in (ci.Item.GetData("FileDrop") as String[]))
                {
                    hashcode += i.GetHashCode();
                }
            }
            else
            {
                foreach (var f in ci.Formats)
                {
                    if (f != "EnhancedMetafile")
                    {
                        var it = ci.Item.GetData(f);
                        hashcode += it.GetHashCode();
                    }
                }
            }
            return(hashcode);
        }