本文整理汇总了C++中COptions::get_BackupType方法的典型用法代码示例。如果您正苦于以下问题:C++ COptions::get_BackupType方法的具体用法?C++ COptions::get_BackupType怎么用?C++ COptions::get_BackupType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COptions
的用法示例。
在下文中一共展示了COptions::get_BackupType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _tmain
//.........这里部分代码省略.........
message.AppendFormat(TEXT("Adding components to snapshot set for writer %s"), writer.get_Name());
OutputWriter::WriteLine(message);
for (unsigned int iComponent = 0; iComponent < writer.get_Components().size(); ++iComponent)
{
CWriterComponent component = writer.get_Components()[iComponent];
if (ShouldAddComponent(component))
{
CString message;
message.AppendFormat(TEXT("Adding component %s (%s) from writer %s"),
component.get_Name(),
component.get_LogicalPath(),
writer.get_Name());
OutputWriter::WriteLine(message);
CHECK_HRESULT(pBackupComponents->AddComponent(
writer.get_InstanceId(),
writer.get_WriterId(),
component.get_Type(),
component.get_LogicalPath(),
component.get_Name()
));
}
else
{
CString message;
message.AppendFormat(TEXT("Not adding component %s from writer %s."),
component.get_Name(), writer.get_Name());
OutputWriter::WriteLine(message);
}
}
}
OutputWriter::WriteLine(TEXT("Calling SetBackupState"));
CHECK_HRESULT(pBackupComponents->SetBackupState(TRUE, FALSE, options.get_BackupType(), FALSE));
OutputWriter::WriteLine(TEXT("Calling PrepareForBackup"));
CComPtr<IVssAsync> pPrepareForBackupResults;
CHECK_HRESULT(pBackupComponents->PrepareForBackup(&pPrepareForBackupResults));
OutputWriter::WriteLine(TEXT("Waiting for call to PrepareForBackup to finish..."));
CHECK_HRESULT(pPrepareForBackupResults->Wait());
HRESULT hrPrepareForBackupResults;
CHECK_HRESULT(pPrepareForBackupResults->QueryStatus(&hrPrepareForBackupResults, NULL));
if (hrPrepareForBackupResults != VSS_S_ASYNC_FINISHED)
{
throw new CShadowSpawnException(TEXT("Prepare for backup failed."));
}
OutputWriter::WriteLine(TEXT("Call to PrepareForBackup finished."));
SYSTEMTIME snapshotTime;
::GetSystemTime(&snapshotTime);
bWorked = ::SetConsoleCtrlHandler(CtrlHandler, TRUE);
if (!bWorked)
{
OutputWriter::WriteLine(TEXT("Unable to set control handler. Ctrl-C and Ctrl-Break may have undesirable results."),
VERBOSITY_THRESHOLD_NORMAL);
}
if (!options.get_Simulate())
{
OutputWriter::WriteLine(TEXT("Calling DoSnapshotSet"));
示例2: startBackup
void startBackup(COptions options)
{
GUID snapshotSetId = GUID_NULL;
bool bSnapshotCreated = false;
bool bAbnormalAbort = true;
CComPtr<IVssBackupComponents> pBackupComponents;
int fileCount = 0;
LONGLONG byteCount = 0;
int directoryCount = 0;
int skipCount = 0;
SYSTEMTIME startTime;
try
{
OutputWriter::SetVerbosityLevel((VERBOSITY_LEVEL)options.get_VerbosityLevel());
//for (int i = 0; i < argc; ++i)
//{
// CString message;
// message.AppendFormat(TEXT("Argument %d: %s"), i, argv[i]);
// OutputWriter::WriteLine(message, VERBOSITY_THRESHOLD_IF_VERBOSE);
//}
OutputWriter::WriteLine(TEXT("Calling CoInitialize"));
CHECK_HRESULT(::CoInitialize(NULL));
CHECK_HRESULT(
::CoInitializeSecurity(
NULL,
-1,
NULL,
NULL,
RPC_C_AUTHN_LEVEL_PKT_PRIVACY,
RPC_C_IMP_LEVEL_IDENTIFY,
NULL,
EOAC_NONE,
NULL));
::GetSystemTime(&startTime);
CString startTimeString;
Utilities::FormatDateTime(&startTime, TEXT(" "), false, startTimeString);
CString message;
message.AppendFormat(TEXT("Starting a %s copy from %s to %s"),
options.get_BackupType() == VSS_BT_FULL ? TEXT("full") : TEXT("incremental"),
options.get_Source(),
options.get_Destination());
OutputWriter::WriteLine(message, VERBOSITY_THRESHOLD_NORMAL);
if (options.get_ClearDestination())
{
if (!Utilities::DirectoryExists(options.get_Destination()))
{
CString message;
message.AppendFormat(TEXT("Skipping recursive delete of destination directory %s because it appears not to exist."),
options.get_Destination());
OutputWriter::WriteLine(message, VERBOSITY_THRESHOLD_NORMAL);
}
else
{
CString message;
message.AppendFormat(TEXT("Recursively deleting destination directory %s."),
options.get_Destination());
OutputWriter::WriteLine(message, VERBOSITY_THRESHOLD_NORMAL);
bool doDelete = options.get_AcceptAll();
if (!doDelete)
{
if (Confirm(message))
{
doDelete = true;
}
else
{
OutputWriter::WriteLine(TEXT("Aborting backup."), VERBOSITY_THRESHOLD_NORMAL);
return;
}
}
if (doDelete)
{
DeleteRecursive(options.get_Destination(), options.get_IgnorePattern());
}
}
}
CBackupState backupState;
LPSYSTEMTIME lastBackupTime;
if (options.get_BackupType() == VSS_BT_INCREMENTAL)
{
backupState.Load(options.get_StateFile());
LPSYSTEMTIME lastFullBackupTime = backupState.get_LastFullBackupTime();
LPSYSTEMTIME lastIncrementalBackupTime = backupState.get_LastIncrementalBackupTime();
if (lastIncrementalBackupTime != NULL)
{
lastBackupTime = lastIncrementalBackupTime;
//.........这里部分代码省略.........