Example #1
0
 /// <summary>
 /// Returns whether two byte arrays are equal
 /// </summary>
 /// <param name="b">The ByteArray to compare to</param>
 /// <returns>True if the values are all equal, false otherwise</returns>
 public bool Equals(ByteArray b)
 {
     return(b.l1 == this.l1 &&
            b.l2 == this.l2);
 }
Example #2
0
 /// <summary>
 /// Check if the table contains an image with the given MD5
 /// </summary>
 /// <param name="key">The MD5 to look for</param>
 /// <returns>True if the key exists, false otherwise</returns>
 public bool ContainsKey(ByteArray key)
 {
     return(this.ht.ContainsKey(key));
 }
Example #3
0
 /// <summary>
 /// Indexer for the hash table
 /// </summary>
 public Image this[ByteArray key] {
     get { return((Image)(((ImageWeakReference)this.ht[key]).Target)); }
 }
Example #4
0
 /// <summary>
 /// Remove a (MD5,image) pair from the hashtable
 /// </summary>
 /// <param name="key">The MD5 of the image to remove</param>
 public void Remove(ByteArray key)
 {
     this.ht.Remove(key);
 }
Example #5
0
 /// <summary>
 /// Add a value to the hashtable as a weak reference.
 /// NOTE: The image will be collected if there is not a strong
 /// reference somewhere else
 /// </summary>
 /// <param name="key">The MD5 of the image</param>
 /// <param name="image">The image object itself</param>
 public void Add(ByteArray key, Image image)
 {
     this.ht.Add(key, new ImageWeakReference(image));
 }