示例#1
0
      /// <summary>
      /// This stage involes the requester (us, again) processing the
      /// information it received from writers on the system to find out
      /// which volumes - if any - must be shadow copied to perform a full
      /// backup.
      /// </summary>
      void Discovery(string fullPath)
      {
         if (ComponentMode)
            // In component mode, we would need to enumerate through each
            // component and decide whether it should be added to our
            // backup document.
            ExamineComponents(fullPath);
         else
            // Once we are finished with the writer metadata, we can dispose
            // of it.  If we were in component mode, we would want to keep it
            // around so that we could notify the writers of our success or
            // failure when we finish the backup.
            _backup.FreeWriterMetadata();

         // Now we use our helper class to add the appropriate volume to the
         // shadow copy set.
         _snap = new Snapshot(_backup);
         _snap.AddVolume(Path.GetPathRoot(fullPath));
      }
示例#2
0
      /// <summary>
      /// The disposal of this object involves sending completion notices
      /// to the writers, removing the shadow copies from the system and
      /// finally releasing the BackupComponents object.  This method must
      /// be called when this class is no longer used.
      /// </summary>
      public void Dispose()
      {
         try { Complete(true); } catch { }

         if (_snap != null)
         {
            _snap.Dispose();
            _snap = null;
         }

         if (_backup != null)
         {
            _backup.Dispose();
            _backup = null;
         }
      }