Ejemplo n.º 1
0
 /// <summary>
 /// Faz uma cópia dos dados do vetor.
 /// </summary>
 /// <param name="src"></param>
 /// <param name="srcIndex"></param>
 /// <param name="dst"></param>
 /// <param name="dstIndex"></param>
 /// <param name="count"></param>
 /// <param name="allowExpantion"></param>
 public static void CopyData(VirtualArray src, VirtualIndex srcIndex, VirtualArray dst, VirtualIndex dstIndex, int count, bool allowExpantion)
 {
     if (((src != null) && (dst != null)) && ((srcIndex != null) && (dstIndex != null)))
     {
         if (src.Size < srcIndex.IndexValue)
         {
             throw new IndexOutOfRangeException();
         }
         srcIndex = srcIndex.Clone();
         dstIndex = dstIndex.Clone();
         while (count > 0)
         {
             Array array = src._baseArray[srcIndex.YIndex] as Array;
             int   num   = 0x13c00 - srcIndex.XIndex;
             if (num > count)
             {
                 num = count;
             }
             Array array2 = null;
             if (dst._baseArray.Count > dstIndex.YIndex)
             {
                 array2 = dst._baseArray[dstIndex.YIndex] as Array;
             }
             int num2 = 0x13c00 - dstIndex.XIndex;
             if (num2 > num)
             {
                 num2 = num;
             }
             if (((array2 == null) || (num2 > (array2.Length - dstIndex.XIndex))) && allowExpantion)
             {
                 if (array2 == null)
                 {
                     array2 = new byte[num2];
                     dst._baseArray.Add(array2);
                 }
                 else
                 {
                     byte[] buffer = new byte[(num2 + array2.Length) - (array2.Length - dstIndex.XIndex)];
                     Buffer.BlockCopy(array2, 0, buffer, 0, array2.Length);
                     array2 = buffer;
                     dst._baseArray[dstIndex.YIndex] = array2;
                 }
             }
             Buffer.BlockCopy(array, srcIndex.XIndex, array2, dstIndex.XIndex, num2);
             count -= num2;
             srcIndex.IncrementBy(num2);
             dstIndex.IncrementBy(num2);
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 /// Faz uma cópia dos dados do vetor.
 /// </summary>
 /// <param name="src"></param>
 /// <param name="srcIndex"></param>
 /// <param name="dst"></param>
 /// <param name="dstIndex"></param>
 /// <param name="count"></param>
 public static void CopyData(VirtualArray src, VirtualIndex srcIndex, VirtualArray dst, VirtualIndex dstIndex, int count)
 {
     CopyData(src, srcIndex, dst, dstIndex, count, false);
 }