/// <summary>
        /// Adds a hard disk
        /// </summary>
        /// <param name="disk">The disk to add</param>
        /// <exception cref="HardDiskException">A hard disk exception is thrown</exception>
        public void AddDisk(HardDisk disk)
        {
            if (_disks.Count == 50)
            {
                throw new HardDiskException("Maximum number of disks exceeded");
            }

            _disks.Add(disk);
        }
        /// <summary>
        /// Add disk of the specified used size and total
        /// </summary>
        /// <param name="used">Used MB</param>
        /// <param name="total">Total MB</param>
        /// <exception cref="HardDiskException">A hard disk exception is thrown</exception>
        public void AddDisk(int used, int total)
        {
            if (_disks.Count == 50)
            {
                throw new HardDiskException("Maximum number of disks exceeded");
            }

            HardDisk disk = new HardDisk(used, total);

            this.AddDisk(disk);
        }
        /// <summary>
        /// Generate a random disks environment for testing purposes
        /// </summary>
        public void GenerateRandom()
        {
            _disks.Clear();

            Random rnd = new Random();

            int numdisks = rnd.Next(1, 50);

            for (int i = 0; i < numdisks - 1; i++)
            {
                this.AddDisk(HardDisk.GenerateRandom());
            }
        }
        /// <summary>
        /// Preconciliates the disks
        /// </summary>
        /// <returns>The minimum number of disks that can hold all the data</returns>
        public int Preconciliate()
        {
            // Create a copy of the drives
            List <HardDisk> diskscopy = new List <HardDisk>();

            foreach (HardDisk disk in _disks)
            {
                HardDisk ndisk = new HardDisk(disk.Used, disk.Total);

                diskscopy.Add(ndisk);
            }

            // Make conciliation
            bool dataMoved = true;

            while (dataMoved == true)
            {
                dataMoved = false;

                for (int i = diskscopy.Count - 1; i >= 0; i--)
                {
                    if (i != 0 && diskscopy[i].Used > 0 && diskscopy[i - 1].Free > 0)
                    {
                        dataMoved = true;
                        diskscopy[i].MoveData(diskscopy[i - 1].Free, diskscopy[i - 1]);
                    }
                }
            }

            // Remove unused disks
            for (int i = diskscopy.Count - 1; i >= 0; i--)
            {
                if (diskscopy[i].Used == 0)
                {
                    diskscopy.RemoveAt(i);
                }
            }

            return(diskscopy.Count);
        }