Пример #1
0
        static void Main(string[] args)
        {
            BackUp   backUp = new BackUp();
            string   path   = @"F:\test.txt";
            string   path2  = @"F:\test2.txt";
            FileInfo fi1    = new FileInfo(path);
            FileInfo fi2    = new FileInfo(path2);

            backUp.AddFileToBackUp(fi1);
            backUp.CreateRestorePoint(false);
            backUp.AddFileToBackUp(fi2);
            backUp.CreateRestorePoint(true);
            //backUp.CreateRestorePoint();
            //backUp.CreateRestorePoint();
            //backUp.SetRestrictionLength(1);
            //backUp.CheckAllRestrictions();
            //backUp.CreateRestorePoint();
            //backUp.CreateRestorePoint();
            //Console.WriteLine(backUp.BackUpSize);
            //backUp.SetRestrictionSize(500);
            //backUp.CheckAllRestrictions();
            // backUp.SetRestrictionsType(false);
            //backUp.SetRestrictionLength(1);
            //backUp.SetRestrictionSize(14500);
            //backUp.CreateRestorePoint(false);
            //backUp.CreateRestorePoint(false);
            ////backUp.CheckAllRestrictions();
            //backUp.Print();
            //Console.ReadLine();
            //backUp.CreateRestorePoint(true);
            //backUp.Print();
        }
Пример #2
0
        public void CreatePoint(BackUp backUp)
        {
            var restorePoint = new RestorePoint(backUp.files);

            backUp.deltafiles.Clear();
            backUp.CheckForDeltaFiles();
            backUp.backUpSize += restorePoint.pointSize;
            backUp.restorePoints.Add(restorePoint);
        }
Пример #3
0
 public int removePoints(BackUp backUp)
 {
     if (CheckSizeRestriction(backUp.restorePoints, backUp))
     {
         return(1);
     }
     else
     {
         return(0);
     }
 }
Пример #4
0
        public void RemovePoint(BackUp backUp)
        {
            if (Restrictions.Count != 0)
            {
                int pointsToBeRemoved = 0;
                if (MinPoints)
                {
                    pointsToBeRemoved = int.MaxValue;
                    for (int i = 0; i < Restrictions.Count; i++)
                    {
                        pointsToBeRemoved = Math.Min(pointsToBeRemoved, Restrictions[i].removePoints(backUp));
                    }
                }
                else
                {
                    pointsToBeRemoved = int.MaxValue;
                    for (int i = 0; i < Restrictions.Count; i++)
                    {
                        pointsToBeRemoved = Math.Max(pointsToBeRemoved, Restrictions[i].removePoints(backUp));
                    }
                }

                backUp.RestorePoints[^ 1].pointSize      -= pointsToBeRemoved;
Пример #5
0
 public int removePoints(BackUp backUp)
 {
     {
         return(1);
     }
Пример #6
0
        public bool CheckDateRestriction(List <RestorePoint> RestorePoints, BackUp backUp)
        {
            var currBranchDate = RestorePoints[backUp.restorePoints.Count - 1];

            return(currBranchDate.Date > LastDateTime);
        }
Пример #7
0
 void removeRestriction(BackUp backUp, IRemovePoint restriction)
 {
     Restrictions.Remove(restriction);
 }
Пример #8
0
 void addRestriction(BackUp backUp, IRemovePoint restriction)
 {
     Restrictions.Add(restriction);
     RemovePoint(backUp);
 }
Пример #9
0
        public bool CheckSizeRestriction(List <RestorePoint> RestorePoints, BackUp backUp)
        {
            var currBranchSize = backUp.BackUpSize;

            return(currBranchSize > MaxSize);
        }