Example #1
0
        public override byte[] ReadSectors(long sectorIndex, int sectorCount)
        {
            List <ArrayPosition> readPositions = TranslateSectors(sectorIndex, sectorCount);

            byte[] result    = new byte[sectorCount * BytesPerSector];
            int    bytesRead = 0;

            foreach (ArrayPosition readPosition in readPositions)
            {
                DynamicColumn column      = m_columns[readPosition.DiskIndex];
                byte[]        stripeBytes = column.ReadSectors(readPosition.SectorIndex, (int)readPosition.SectorCount);
                Array.Copy(stripeBytes, 0, result, bytesRead, stripeBytes.Length);
                bytesRead += stripeBytes.Length;
            }

            return(result);
        }
Example #2
0
        public override byte[] ReadSectors(long sectorIndex, int sectorCount)
        {
            CheckBoundaries(sectorIndex, sectorCount);
            List <ArrayPosition> readPositions = TranslateSectors(sectorIndex, sectorCount);

            byte[] result    = new byte[sectorCount * BytesPerSector];
            int    bytesRead = 0;

            foreach (ArrayPosition readPosition in readPositions)
            {
                DynamicColumn column = m_columns[readPosition.DiskIndex];
                byte[]        stripeBytes;

                if (column.IsOperational)
                {
                    stripeBytes = column.ReadSectors(readPosition.SectorIndex, readPosition.SectorCount);
                }
                else
                {
                    stripeBytes = new byte[readPosition.SectorCount * BytesPerDynamicDiskSector];
                    for (int index = 0; index < m_columns.Count; index++)
                    {
                        if (index != readPosition.DiskIndex)
                        {
                            byte[] currentBytes = m_columns[index].ReadSectors(readPosition.SectorIndex, readPosition.SectorCount);
                            stripeBytes = XOR(stripeBytes, currentBytes);
                        }
                    }
                }

                Array.Copy(stripeBytes, 0, result, bytesRead, stripeBytes.Length);
                bytesRead += stripeBytes.Length;
            }

            return(result);
        }
Example #3
0
 public override byte[] ReadSectors(long sectorIndex, int sectorCount)
 {
     CheckBoundaries(sectorIndex, sectorCount);
     return(m_column.ReadSectors(sectorIndex, sectorCount));
 }