Пример #1
0
        /// <summary>
        /// Compara a instancia com outro objeto.
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public int CompareTo(object obj)
        {
            VirtualIndex index = null;

            if (obj is VirtualIndex)
            {
                index = obj as VirtualIndex;
            }
            else if (obj is int)
            {
                index = new VirtualIndex((int)obj);
            }
            else
            {
                return(-1);
            }
            if (index.IndexValue == this.IndexValue)
            {
                return(0);
            }
            if (index.IndexValue > this.IndexValue)
            {
                return(-1);
            }
            return(1);
        }
Пример #2
0
        /// <summary>
        /// Cria um clone da instancia.
        /// </summary>
        /// <returns></returns>
        public VirtualIndex Clone()
        {
            VirtualIndex index = new VirtualIndex();

            index._x = this._x;
            index._y = this._y;
            return(index);
        }
Пример #3
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);
         }
     }
 }
Пример #4
0
 /// <summary>
 /// Define o valor na posição do indice informado.
 /// </summary>
 /// <param name="vIndex"></param>
 /// <param name="value"></param>
 public void SetValueAt(VirtualIndex vIndex, byte value)
 {
     byte[] buffer = _baseArray[vIndex.YIndex] as byte[];
     buffer[vIndex.XIndex] = value;
 }
Пример #5
0
 /// <summary>
 /// Recupera o valor na posição do indice informado.
 /// </summary>
 /// <param name="vIndex"></param>
 /// <returns></returns>
 public byte GetValueAt(VirtualIndex vIndex)
 {
     byte[] buffer = _baseArray[vIndex.YIndex] as byte[];
     return(buffer[vIndex.XIndex]);
 }
Пример #6
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);
 }