public async Task Create() { if (!Enabled) { return; } SetupDirecory(); await SnapshotDatabase(); await CreateSnapshotCookies(); DiskBlobStorageProvider.GetRoot(SnapshotsDirectory) .CopyTo(DiskBlobStorageProvider.Root.FullName, overwrite: true); await SaveDate(); await SaveUrl(); }
public async Task Restore() { if (!Exists()) { throw new DirectoryNotFoundException("Cannot find snapshot " + SnapshotName); } var restoreDatabase = LocalTime.Now; await RestoreDatabase(); Debug.WriteLine("Total time for restoring including mutex: " + LocalTime.Now.Subtract(restoreDatabase).Milliseconds); var restoreCookies = LocalTime.Now; await RestoreCookies(); Debug.WriteLine("Total time for restoring cookies: " + LocalTime.Now.Subtract(restoreCookies).Milliseconds); var restoreFiles = LocalTime.Now; DiskBlobStorageProvider.GetRoot(SnapshotsDirectory) .CopyTo(DiskBlobStorageProvider.Root.FullName, overwrite: true); Debug.WriteLine("Total time for restoring files: " + LocalTime.Now.Subtract(restoreFiles).Milliseconds); var restoreDate = LocalTime.Now; await RestoreDate(); Debug.WriteLine("Total time for restoring date: " + LocalTime.Now.Subtract(restoreDate).Milliseconds); var restoreUrl = LocalTime.Now; await RestoreUrl(); Debug.WriteLine("Total time for restoring url: " + LocalTime.Now.Subtract(restoreUrl).Milliseconds); }