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(); }
public void CreatePoint(BackUp backUp) { var restorePoint = new RestorePoint(backUp.files); backUp.deltafiles.Clear(); backUp.CheckForDeltaFiles(); backUp.backUpSize += restorePoint.pointSize; backUp.restorePoints.Add(restorePoint); }
public int removePoints(BackUp backUp) { if (CheckSizeRestriction(backUp.restorePoints, backUp)) { return(1); } else { return(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;
public int removePoints(BackUp backUp) { { return(1); }
public bool CheckDateRestriction(List <RestorePoint> RestorePoints, BackUp backUp) { var currBranchDate = RestorePoints[backUp.restorePoints.Count - 1]; return(currBranchDate.Date > LastDateTime); }
void removeRestriction(BackUp backUp, IRemovePoint restriction) { Restrictions.Remove(restriction); }
void addRestriction(BackUp backUp, IRemovePoint restriction) { Restrictions.Add(restriction); RemovePoint(backUp); }
public bool CheckSizeRestriction(List <RestorePoint> RestorePoints, BackUp backUp) { var currBranchSize = backUp.BackUpSize; return(currBranchSize > MaxSize); }