Beispiel #1
0
        private void MarkFile(string filePath)
        {
            Defrag.Defrag defrag = new Defrag.Defrag();

            BitArray volMap = defrag.GetVolumeMap(filePath.Substring(0, 2));
            int clustersPerCell = volMap.Length / MaxCells;
            long[,] fileMap = defrag.GetFileMap(filePath);
            SolidColorBrush brush = fileMap.Length > 2 ? Brushes.Red : Brushes.Blue;

            int startCell = (int)fileMap[0, 1] / clustersPerCell;
            int endCell = (int)(fileMap[0, 1] + fileMap[0, 0]) / clustersPerCell;
            for (int j = startCell; j <= endCell; j++)
            {
                VolumeMap[j] = brush;
            }
            for (int i = 1; i < fileMap.Length / 2; i++)
            {
                startCell = (int)fileMap[i, 1] / clustersPerCell;
                endCell = (int)(fileMap[i, 0] - fileMap[i - 1, 0] + fileMap[i, 1]) / clustersPerCell;
                if (endCell == MaxCells)
                    --endCell;

                for (int j = startCell; j <= endCell; j++)
                {
                    VolumeMap[j] = brush;
                }
            }
        }
Beispiel #2
0
        private void MarkFile(string filePath)
        {
            Defrag.Defrag defrag = new Defrag.Defrag();

            BitArray volMap          = defrag.GetVolumeMap(filePath.Substring(0, 2));
            int      clustersPerCell = volMap.Length / MaxCells;

            long[,] fileMap = defrag.GetFileMap(filePath);
            SolidColorBrush brush = fileMap.Length > 2 ? Brushes.Red : Brushes.Blue;

            int startCell = (int)fileMap[0, 1] / clustersPerCell;
            int endCell   = (int)(fileMap[0, 1] + fileMap[0, 0]) / clustersPerCell;

            for (int j = startCell; j <= endCell; j++)
            {
                VolumeMap[j] = brush;
            }
            for (int i = 1; i < fileMap.Length / 2; i++)
            {
                startCell = (int)fileMap[i, 1] / clustersPerCell;
                endCell   = (int)(fileMap[i, 0] - fileMap[i - 1, 0] + fileMap[i, 1]) / clustersPerCell;
                if (endCell == MaxCells)
                {
                    --endCell;
                }

                for (int j = startCell; j <= endCell; j++)
                {
                    VolumeMap[j] = brush;
                }
            }
        }
        public void OpenVolumeTest()
        {
            Defrag.Defrag defrag = new Defrag.Defrag();

            //defrag.MoveFile("H:", @"H:\EGU.rar", 1000, 35000, 1);

            defrag.FragmentFile(@"H:\EGU.rar");
            //defrag.FragmentFile(@"H:\CPU-Z.zip");

            //defrag.DefragmentFile(@"H:\EGU.rar");
        }
Beispiel #4
0
        public void OpenVolumeTest()
        {
            Defrag.Defrag defrag = new Defrag.Defrag();

            //defrag.MoveFile("H:", @"H:\EGU.rar", 1000, 35000, 1);

            defrag.FragmentFile(@"H:\EGU.rar");
            //defrag.FragmentFile(@"H:\CPU-Z.zip");

            //defrag.DefragmentFile(@"H:\EGU.rar");
        }
Beispiel #5
0
        private void SetUpVolumeMap(string filePath)
        {
            VolumeMap.Clear();

            Defrag.Defrag defrag          = new Defrag.Defrag();
            BitArray      volMap          = defrag.GetVolumeMap(filePath.Substring(0, 2));
            int           clustersPerCell = volMap.Length / MaxCells;

            for (int i = 0; i < MaxCells - 1; i++)
            {
                VolumeMap.Add(IsEngaged(volMap, i * clustersPerCell, i * clustersPerCell + clustersPerCell)
                                  ? Brushes.DarkGray
                                  : Brushes.Snow);
            }

            VolumeMap.Add(IsEngaged(volMap, (MaxCells - 1) * clustersPerCell, volMap.Length)
                            ? Brushes.DarkGray
                            : Brushes.Snow);
        }
Beispiel #6
0
        private void SetUpVolumeMap(string filePath)
        {
            VolumeMap.Clear();

            Defrag.Defrag defrag = new Defrag.Defrag();
            BitArray volMap = defrag.GetVolumeMap(filePath.Substring(0, 2));
            int clustersPerCell = volMap.Length / MaxCells;

            for (int i = 0; i < MaxCells - 1; i++)
            {
                VolumeMap.Add(IsEngaged(volMap, i * clustersPerCell, i * clustersPerCell + clustersPerCell)
                                  ? Brushes.DarkGray
                                  : Brushes.Snow);
            }

            VolumeMap.Add(IsEngaged(volMap, (MaxCells - 1) * clustersPerCell, volMap.Length)
                            ? Brushes.DarkGray
                            : Brushes.Snow);
        }
Beispiel #7
0
 public void DefragFile(string filePath)
 {
     Defrag.Defrag defrag = new Defrag.Defrag();
     defrag.DefragmentFile(filePath);
 }
Beispiel #8
0
 public void DefragFile(string filePath)
 {
     Defrag.Defrag defrag = new Defrag.Defrag();
     defrag.DefragmentFile(filePath);
 }