private HuFileEntry GetFileEntry(string Filename, int EntrySector) { int Sector = EntrySector; Filename = Filename.ToUpper(); // 名前 string Name = Path.GetFileNameWithoutExtension(Filename); if (Name.Length > HuFileEntry.MaxNameLength) { Name = Name.Substring(0, HuFileEntry.MaxNameLength); } // 拡張子 string Extension = Path.GetExtension(Filename); if (Extension.Length > 0) { Extension = Extension.Substring(1); } if (Extension.Length > HuFileEntry.MaxExtensionLength) { Extension = Extension.Substring(0, HuFileEntry.MaxExtensionLength); } Filename = Name + "." + Extension; for (int i = 0; i < ClusterPerSector; i++, Sector++) { var dc = DiskImage.GetDataControllerForRead(Sector); for (var j = 0; j < EntriesInSector; j++) { int pos = (j * FileEntrySize); var mode = dc.GetByte(pos); if (mode == EntryEnd) { return(null); } string EntryName = TextEncoding.GetString(dc.Copy(pos + 0x01, HuFileEntry.MaxNameLength)).TrimEnd((Char)0x20); string EntryExtension = TextEncoding.GetString(dc.Copy(pos + 0x0e, HuFileEntry.MaxExtensionLength)).TrimEnd((Char)0x20); string EntryFilename = (EntryName + "." + EntryExtension).ToUpper(); if (Filename != EntryFilename) { continue; } return(GetEntry(dc, Sector, pos)); } } return(null); }
private HuFileEntry GetNewFileEntry(int Sector) { for (int i = 0; i < ClusterPerSector; i++) { var dc = DiskImage.GetDataControllerForRead(Sector + i); for (var j = 0; j < EntriesInSector; j++) { int pos = (j * FileEntrySize); var mode = dc.GetByte(pos); if (mode != EntryEnd && mode != EntryDelete) { continue; } return(new HuFileEntry { EntrySector = Sector + i, EntryPosition = pos }); } } return(null); }
public List <HuFileEntry> GetEntriesFromSector(int Sector) { List <HuFileEntry> FileList = new List <HuFileEntry>(); for (int i = 0; i < ClusterPerSector; i++, Sector++) { var dc = DiskImage.GetDataControllerForRead(Sector); for (var j = 0; j < 8; j++) { int pos = (j * 0x20); var mode = dc.GetByte(pos); if (mode == EntryEnd) { return(FileList); } if (mode == EntryDelete) { continue; } FileList.Add(GetEntry(dc, Sector, pos)); } } return(FileList); }