예제 #1
0
 public BackupClass(string absPath)
 {
     this.absPath       = absPath;
     this.Name          = DirectoryUtil.GetFolderName(this.absPath);
     this.zip           = new ZipUtil(ZipUtil.GetZipFilePathFromFolder(this.absPath, this.Name));
     this.completedFile = new CompFileUtil(CompFileUtil.GetCompFilePathFromFolder(this.absPath, this.Name));
     this.CreatedOn     = MiscHelper.StringToDate(this.Name);
 }
예제 #2
0
        /// <summary>
        /// Create a .zip and .zip.comp file inside the backup directory to be used for current backup
        /// </summary>
        /// <returns>Path of the zip file</returns>
        public BackupClass CreateBackup()
        {
            string date         = MiscHelper.GetDateString();
            string absolutePath = Path.Combine(this.BackupFolder, date);

            // Create a directory if it does not exist
            DirectoryUtil.CreateOrThrow(absolutePath);

            // Create zip file
            ZipUtil.CreateOrThrow(ZipUtil.GetZipFilePathFromFolder(absolutePath, date));

            // Create comp file
            CompFileUtil.CreateOrThrow(Path.Combine(absolutePath, date + ".zip.comp.txt"));
            return(new BackupClass(absolutePath));
        }