private bool FindNextDirEntry(DirEntryLocation DirEntry, out DirEntryLocation ResultDirEntry) { ResultDirEntry = null; if (DirEntry.DirEntry < 7) { ResultDirEntry = new DirEntryLocation(DirEntry.Track, DirEntry.Sector, DirEntry.DirEntry + 1); return(true); } Location nextSector = Tracks[DirEntry.Track - 1].Sectors[DirEntry.Sector].NextLocation; if (nextSector == null) { return(false); } Sector sec = Tracks[nextSector.Track - 1].Sectors[nextSector.Sector]; ResultDirEntry = new DirEntryLocation(sec.TrackNo, sec.SectorNo, 0); return(true); }
public bool MoveFileUp(Types.FileInfo File) { _LastError = ""; if (File.DirEntryIndex == 0) { return(false); } DirEntryLocation dirLocOrig = LocateDirEntry(File.DirEntryIndex); if (dirLocOrig == null) { return(false); } DirEntryLocation dirLocPrev = LocateDirEntry(File.DirEntryIndex - 1); Sector secOrig = Tracks[dirLocOrig.Track - 1].Sectors[dirLocOrig.Sector]; Sector secPrev = Tracks[dirLocPrev.Track - 1].Sectors[dirLocPrev.Sector]; // exchange dir entry content GR.Memory.ByteBuffer tempData = secOrig.Data.SubBuffer(0x20 * dirLocOrig.DirEntry + 2, 30); secPrev.Data.CopyTo(secOrig.Data, 0x20 * dirLocPrev.DirEntry + 2, 30, 0x20 * dirLocOrig.DirEntry + 2); tempData.CopyTo(secPrev.Data, 0, 30, 0x20 * dirLocPrev.DirEntry + 2); return(true); }