/// <summary> /// Connects to the configured backup archive /// </summary> static void Connect() { Console.Write(" Connecting to the backup store..."); engine = new Engine() { Connection = new Connection(connectionString), Canceler = canceler.Token }; Console.WriteLine("done."); try { engine.OnProgress += HandleProgress; engine.OnError += HandleError; var exists = engine.Connection .ListArchives() .Contains(archiveName, StringComparer.OrdinalIgnoreCase); // remove the existing archive if (exists && deleteArchive) { Console.Write(" Deleting the existing archive {0}...", archiveName); engine.DeleteArchive(archiveName); Console.WriteLine("done."); exists = false; } // open an existing archive or create a new archive if (exists) { Console.Write(" Opening the existing archive {0}...", archiveName); engine.OpenArchive(archiveName, password); Console.WriteLine("done."); } else { Console.Write(" Creating the archive {0}...", archiveName); engine.CreateArchive(archiveName, password); Console.WriteLine("done."); } } catch { engine.Dispose(); throw; } }