Example #1
0
 /// <summary>
 /// Connects to the configured backup archive
 /// </summary>
 static void Connect()
 {
     engine = new Engine()
      {
     Connection = new Connection(connectionString),
     Canceler = canceler.Token
      };
      try
      {
     engine.OnProgress += HandleProgress;
     engine.OnError += HandleError;
     engine.OpenArchive(archiveName, password);
     if (cleanupSessions)
     {
        Console.Write("   Deleting existing restore sessions...");
        foreach (var session in engine.Archive.Restores)
           engine.DeleteRestore(session);
        Console.WriteLine("done.");
     }
      }
      catch
      {
     engine.Dispose();
     throw;
      }
 }