示例#1
0
        /// <summary>
        /// Checks if there is available room in the image for a <see cref="DirectoryRecord"/> at its current sector.
        /// </summary>
        /// <param name="record">The <see cref="DirectoryRecord"/> to be checked.</param>
        /// <param name="sectorsneedded">The number of sectors needed by the <see cref="DirectoryRecord"/>.</param>
        /// <returns>Return true if there is available room in the image for the file at its current sector. Otherwise, false.</returns>
        public Boolean CheckForRoom(DirectoryRecord record, Int32 sectorsneedded)
        {
            Assert.IsNotNull(record, nameof(record));

            var sectorsneedsed = Enumerable.Range((Int32)record.SectorNumber, sectorsneedded).Skip(1);

            foreach (var sector in sectorsneedsed)
            {
                if (SectorMap.ContainsKey((UInt32)sector) == true)
                {
                    return(false);
                }
            }

            return(true);
        }