private void UIFiles_SelectedIndexChanged(object sender, EventArgs e) { string fileName = (string)UIFiles.SelectedItem; if (string.IsNullOrEmpty(fileName)) return; selectedFileInfo = FileSystem.GetFileInfo(fileName); fileSectorList = new List<int>(); foreach (var sec in selectedFileInfo.SectorList) { fileSectorList.Add(sec.Sector); } UpdateMap(); }
/// <summary> /// Gets the details of where a file is stored on the disk /// </summary> /// <param name="filename">Filename to get information for</param> /// <returns>FileInfo object</returns> public override FileInfo GetFileInfo(string filename) { Attach(); var info = new FileInfo(); // Find directory entry info.DirEntry = FindDirectoryEntry(filename); if (info.DirEntry == null) throw new FileNotFoundException(); // Read sector list int sectorCount = 0; var sector = info.DirEntry.StartSector; if (!this.diskImage.IsValidSector(sector)) { info.FileErrors.Add(string.Format("Start sector {0} is invalid", sector)); return info; } while ((sectorCount < info.DirEntry.NumSectors)) { var sec = ReadFileSector(sector); sectorCount += 1; info.SectorList.Add(sec); if (sectorCount != info.DirEntry.NumSectors && !this.diskImage.IsValidSector(sec.NextSector)) { info.FileErrors.Add(string.Format("Sector {0} links to invalid sector {1}", sector, sec.NextSector)); break; } sector = sec.NextSector; } return info; }