示例#1
0
        public override void CalculateSteps()
        {
            base.CalculateSteps();

            if (workspaceService.Exists(diskPath))
            {
                zipFileSystem = workspaceService.Get(diskPath).Value as ZipFileSystem;

                if (zipFileSystem == null || zipFileSystem.PhysicalRoot == null)
                {
                    return;
                }

                // Get the physical path
                physicalPath       = zipFileSystem.PhysicalRoot;
                physicalBackupPath = zipFileSystem.PhysicalRoot + ".bak";

                steps.Add(BackupZip);

                // Get all the files
                var srcFiles = zipFileSystem.GetEntitiesRecursive(WorkspacePath.Root).ToArray();

                // Convert files into the correct format: src/dest path
                var files = new Dictionary <WorkspacePath, WorkspacePath>();
                foreach (var file in srcFiles)
                {
                    files.Add(diskPath.AppendPath(file), file);
                }

                // Create the  zip exporter
                zipExporter = new ZipExporter(diskPath.Path, FileLoadHelper, files);

                // Calculate all the zip steps
                zipExporter.CalculateSteps();

                for (int i = 0; i < zipExporter.totalSteps; i++)
                {
                    steps.Add(NextZipStep);
                }

                // Save the disk
                steps.Add(SaveDisk);

                steps.Add(CheckForErrors);

                steps.Add(Cleanup);
            }
        }