Beispiel #1
0
      public void Initialize(VssSnapshotContext context, string xmlDoc = null, bool duringRestore = false)
      {
         m_backupComponents = Implementation.CreateVssBackupComponents();
         m_duringRestore = duringRestore;

         if (m_duringRestore)
         {
            Host.WriteVerbose("- Calling IVssBackupComponents.InitializeForRestore() {0} xml doc.", xmlDoc == null ? "without" : "with");
            m_backupComponents.InitializeForRestore(xmlDoc);
         }
         else
         {
            Host.WriteVerbose("- Calling IVssBackupComponents.InitializeForBackup() {0} xml doc.", xmlDoc == null ? "without" : "with");
            m_backupComponents.InitializeForBackup(xmlDoc);

            if (OperatingSystemInfo.IsAtLeast(OSVersionName.WindowsServer2003) && context != VssSnapshotContext.Backup)
            {
               Host.WriteLine("- Setting the VSS context to: {0}", context);
               m_backupComponents.SetContext(context);
            }
         }

         m_context = (VssVolumeSnapshotAttributes)context;

         m_backupComponents.SetBackupState(true, true, VssBackupType.Full, false);
      }