Ejemplo n.º 1
0
        private void GetDiskFSInfoSector()
        {
            DiskStream.Seek(512, SeekOrigin.Begin);
            byte[] bTemp = new byte[512];
            DiskStream.Read(bTemp, 0, 512);
            DiskFSInfoSector = new FSInfoSector(bTemp);

            //Actualizamos espacio libre aprox
            long spaceAvailableBytes = DiskFSInfoSector.GetFreeClusterCount() * DiskBootSector.GetBytesPerCluster();

            //GB
            if (spaceAvailableBytes >= (1024 * 1024 * 1024))
            {
                float tamano = spaceAvailableBytes / (1024 * 1024 * 1024);
                freeSpaceAvailable.Text = "" + tamano + " GB";
            }
            //MB
            else if (spaceAvailableBytes >= (1024 * 1024))
            {
                float tamano = spaceAvailableBytes / (1024 * 1024);
                freeSpaceAvailable.Text = "" + tamano + " MB";
            }
            //KB
            else if (spaceAvailableBytes >= 1024)
            {
                float tamano = spaceAvailableBytes / 1024;
                freeSpaceAvailable.Text = "" + tamano + " KB";
            }
            else
            {
                freeSpaceAvailable.Text = "" + spaceAvailableBytes + " bytes";
            }
        }
Ejemplo n.º 2
0
        public FilesystemInformation(BootSector BS, FSInfoSector FSInfo)
        {
            InitializeComponent();
            this.MaximumSize = this.MinimumSize = this.Size;
            BootSector       = BS;
            FSInfoSector     = FSInfo;

            //General
            this.volumeIDLabel.Text = BootSector.GetVolumeID();
            this.volumeLabel.Text   = BootSector.GetVolumeLabel();

            //Boot Sector
            this.labelBPS.Text = BootSector.GetBytesPerSector().ToString();
            this.labelSPC.Text = BootSector.GetSectorsPerCluster().ToString();
            this.labelSectoresReservados.Text = BootSector.GetReservedSectors().ToString();
            this.labelTotalSectores.Text      = BootSector.GetTotalSectoresFAT32().ToString();
            this.labelFATSize.Text            = BootSector.SizeOfFAT().ToString();

            //FSInfo Sector
            this.lastAllocatedCluster.Text = FSInfoSector.GetLastAllocatedCluster().ToString();
            this.freeClusters.Text         = FSInfoSector.GetFreeClusterCount().ToString();

            //File Allocation Table
            fatSize.Text    = BootSector.SizeOfFAT().ToString();
            fat1Offset.Text = BootSector.FATOffset().ToString();
            fat2Offset.Text = BootSector.FAT2Offset().ToString();
        }