예제 #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);
 }
예제 #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));
 }
예제 #3
0
 /// <summary>
 /// Indexer for the hash table
 /// </summary>
 public Image this[ByteArray key] {
     get { return((Image)(((ImageWeakReference)this.ht[key]).Target)); }
 }
예제 #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);
 }
예제 #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));
 }