Exemplo n.º 1
0
 /// <summary>
 /// Copies the elements of the <see cref="ChecksumsList" /> to an <seealso cref="Array" />, starting at a particular <seealso cref="Array" /> index.
 /// </summary>
 /// <param name="array">The one-dimensional <seealso cref="Array" /> that is the destination of the elements copied from <see cref="ChecksumsList" />.
 /// The <seealso cref="Array" /> must have zero-based indexing.</param>
 /// <param name="arrayIndex">The zero-based index in <paramref name="array" /> at which copying begins.</param>
 /// <exception cref="ArgumentNullException"><paramref name="array" /> is null.</exception>
 /// <exception cref="ArgumentOutOfRangeException"><paramref name="arrayIndex" /> is less than 0.</exception>
 /// <exception cref="ArgumentException">The number of elements in the source <see cref="ChecksumsList" /> is greater than the available space from <paramref name="arrayIndex" /> to the end of the destination <paramref name="array" />.</exception>
 public void CopyTo(ContentMD5Group[] array, int arrayIndex)
 {
     if (array == null)
     {
         throw new ArgumentNullException("array");
     }
     if (arrayIndex < 0)
     {
         throw new ArgumentOutOfRangeException("arrayIndex", "Array index cannot be less than zero");
     }
     Monitor.Enter(Content.SyncRoot);
     try
     {
         if (((long)arrayIndex + Content._md5Count) > array.LongLength)
         {
             throw new ArgumentException("Not enough available space at the end of the array", "arrayIndex");
         }
         long index = (long)arrayIndex;
         for (ContentMD5Group node = Content._firstMD5Node; node != null; node = node._nextNode)
         {
             try { array.SetValue(node, index); }
             catch (Exception exception)
             {
                 if (((long)arrayIndex + Content._md5Count) > array.LongLength)
                 {
                     throw new ArgumentException("Not enough available space at the end of the array", "arrayIndex", exception);
                 }
                 throw new ArgumentException(exception.Message, "array", exception);
             }
             index++;
         }
     }
     finally { Monitor.Exit(Content.SyncRoot); }
 }
Exemplo n.º 2
0
 internal void Clear()
 {
     Monitor.Enter(Content.SyncRoot);
     try
     {
         ContentMD5Group firstRemoved = Content._firstMD5Node;
         if (firstRemoved == null)
         {
             return;
         }
         Content._firstMD5Node = Content._lastMD5Node = null;
         Content._md5Count     = 0;
         ContentMD5Group previous;
         do
         {
             firstRemoved._owner = null;
             firstRemoved        = (previous = firstRemoved)._nextNode;
             previous._nextNode  = null;
         } while (firstRemoved != null);
     }
     finally { Monitor.Exit(Content.SyncRoot); }
 }
Exemplo n.º 3
0
 internal bool Remove(ContentMD5Group item)
 {
     Monitor.Enter(Content.SyncRoot);
     try
     {
         if (item._owner != null && ReferenceEquals(item._owner, this))
         {
             // List<ContentMD5Group> list = Content._innerList;
             // for (int i = 0; i < list.Count; i++)
             // {
             //     if (ReferenceEquals(list[i], item))
             //     {
             //         list.RemoveAt(i);
             //         return true;
             //     }
             // }
             throw new NotImplementedException();
         }
     }
     finally { Monitor.Exit(Content.SyncRoot); }
     return(false);
 }
Exemplo n.º 4
0
 public long IndexOf(ContentMD5Group item)
 {
     if (item != null)
     {
         Monitor.Enter(Content.SyncRoot);
         try
         {
             if (item._owner != null && ReferenceEquals(item._owner, this))
             {
                 long index = 0;
                 for (ContentMD5Group node = Content._firstMD5Node; node != null; node = node._nextNode)
                 {
                     if (ReferenceEquals(item, node))
                     {
                         return(index);
                     }
                     index++;
                 }
             }
         }
         finally { Monitor.Exit(Content.SyncRoot); }
     }
     return(-1L);
 }
Exemplo n.º 5
0
 public bool Equals(ContentMD5Group other)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 6
0
 void ICollection <ContentMD5Group> .Add(ContentMD5Group item) => throw new NotSupportedException();
Exemplo n.º 7
0
 bool ICollection <ContentMD5Group> .Remove(ContentMD5Group item) => Remove(item);
Exemplo n.º 8
0
 void IList <ContentMD5Group> .Insert(int index, ContentMD5Group item) => throw new NotSupportedException();
Exemplo n.º 9
0
                int IList <ContentMD5Group> .IndexOf(ContentMD5Group item)
                {
                    long index = IndexOf(item);

                    return((index > (long)(int.MaxValue)) ? -2 : (int)index);
                }
Exemplo n.º 10
0
                public bool Contains(ContentMD5Group item)
                {
                    ChecksumsList owner;

                    return(item != null && (owner = item._owner) != null && ReferenceEquals(owner, this));
                }