Ejemplo n.º 1
0
        public void AddIncrementalPoint(string pathName, RestorePoint dep)
        {
            List <string> filesName = new List <string>();

            foreach (var file in dep.GetFiles())
            {
                if (!File.Exists(file.GetName()))
                {
                    continue; //faila net
                }
                if (file.GetSize() != File.ReadAllText(file.GetName()).Length || File.GetLastWriteTime(file.GetName()).Ticks != file.GetLastWriteTime())
                {
                    filesName.Add(file.GetName());
                }
            }

            List <FileInfo> files = new List <FileInfo>();

            foreach (var file in filesName)
            {
                if (!File.Exists(file))
                {
                    throw new Exception($"{file}: there isn't such file");
                }
                files.Add(new FileInfo(file));
            }
            var incPoint = new Incremental(pathName, files, dep);

            _points.Add(pathName, incPoint);
        }
Ejemplo n.º 2
0
 public Incremental(string name, List <FileInfo> files, RestorePoint dp)
 {
     Depend = dp;
     Type   = 0;
     Time   = DateTime.Now.Ticks;
     Name   = name;
     Files  = files;
     foreach (var file in files)
     {
         Size += file.GetSize();
     }
 }