示例#1
0
 public void ReloadData(bool DoDeletedEntries)
 {
     Entries e = new Entries(this);
     //This will get our blocks occupied
     BlocksOccupied = e.GetBlocksOccupied(BlocksOccupied[0]);
     //This will get the files and folders
     Files(DoDeletedEntries);
 }
示例#2
0
 public File(FATXDrive DRIVE, PartitionInfo partition)
 {
     PartInfo = partition;
     e = new Entries(this);
     Drive = DRIVE;
     Misc = new Misc();
 }
示例#3
0
 public Folder(FATXDrive DRIVE, PartitionInfo partition)
 {
     PartInfo = partition;
     e = new Entries(this);
     Drive = DRIVE;
     Misc = new Misc();
     isfolder = true;
 }
示例#4
0
        private object[] CheckIfBlocksNeeded(Folder f)
        {
            //Create our object array that will hold our Bool and Entry for if
            //we need an open block, and if there's a deleted file

            //Create our entry reader so that we can get a return of entries...
            Entries e = new Entries(f);
            //Get our entries in the last block
            EntryData[] eData = e.GetEntries(f.BlocksOccupied[f.BlocksOccupied.Length - 1]);
            //Files span upon multiple blocks... Here we go to the last block that it occupies
            //(the most recent block created), and check if it has any open entries

            //Check for deleted entries
            foreach (EntryData E in eData)
            {
                if (E.FileNameSize == (byte)Info.FileFlags.Deleted)
                {
                    return new object[] { true, E };
                }
            }
            //We didn't find a deleted entry, but we have room in the last block of the folder
            //for a new entry
            if (eData.Length < 100)
            {
                EntryData newEntry = new EntryData();
                newEntry.EntryOffset = eData[eData.Length - 1].EntryOffset + 0x40;
                newEntry.StartingCluster = eData[eData.Length - 1].StartingCluster;
                return new object[] { false, newEntry };
            }
            //We don't have any deleted entries, and don't have enough room in the last block,
            //so let's create a new block, add it to the FAT chain, etc.

            //Get our new block...
            uint nextBlock = new FATStuff(f).GetFreeBlocks(1, f.BlocksOccupied[f.BlocksOccupied.Length - 1], 0, false)[0];
            //Write the fat chain
            WriteFATChain(new uint[] { f.BlocksOccupied[f.BlocksOccupied.Length - 1], nextBlock}, f);
            //Create our new entrydata
            EntryData EntryNew = new EntryData();
            EntryNew.EntryOffset = m.GetBlockOffset(nextBlock, f);
            return new object[] { false, EntryNew };
        }