示例#1
0
文件: Program.cs 项目: Belython/ITMO
        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);
        }