public unsafe void AssignLayout(TrackFormat layout, int track, int syncSectorNumber = int.MinValue, int firstIndex = 0)
        {
            int minSectorIndex  = 0;
            int minSectorNumber = int.MaxValue;

            for (int i = firstIndex; i < layout.Layout.Cnt; i++)
            {
                if (layout.Layout.Data[i].SectorNumber < minSectorNumber)
                {
                    minSectorNumber = layout.Layout.Data[i].SectorNumber;
                    minSectorIndex  = i;
                }
            }
            int len = Math.Max(0, layout.Layout.Cnt - firstIndex);

            Layout.EnsureCapacity(len);
            Layout.Cnt = len;
            for (int i = 0, j = minSectorIndex; i < len; i++)
            {
                Layout.Data[i] = layout.Layout.Data[j];
                if (syncSectorNumber != int.MinValue && Layout.Data[i].SectorNumber == syncSectorNumber)
                {
                    SyncByHeader(track, syncSectorNumber);
                }
                j++;
                if (j >= layout.Layout.Cnt)
                {
                    j = firstIndex;
                }
            }
            FormatName  = GetFormatName();
            SpinTime    = GetSpinTime();
            LayoutTrack = track;
        }
Exemple #2
0
 public void CopyTo(MList <T> dest)
 {
     dest.EnsureCapacity(Cnt);
     dest.Cnt = Cnt;
     Array.Copy(Data, 0, dest.Data, 0, Cnt);
 }