本文整理汇总了C++中COptions::get_VerbosityLevel方法的典型用法代码示例。如果您正苦于以下问题:C++ COptions::get_VerbosityLevel方法的具体用法?C++ COptions::get_VerbosityLevel怎么用?C++ COptions::get_VerbosityLevel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COptions
的用法示例。
在下文中一共展示了COptions::get_VerbosityLevel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _tmain
int _tmain(int argc, _TCHAR* argv[])
{
//::DebugBreak();
OutputWriter::SetVerbosityLevel(VERBOSITY_LEVEL_NORMAL);
OutputWriter::WriteLine(TEXT("ShadowSpawn (c) 2011 Craig Andera. [email protected]"),
VERBOSITY_THRESHOLD_UNLESS_SILENT);
OutputWriter::WriteLine(TEXT(""), VERBOSITY_THRESHOLD_UNLESS_SILENT);
bool bAbnormalAbort = true;
DWORD exitCode = 0;
int fileCount = 0;
LONGLONG byteCount = 0;
int directoryCount = 0;
int skipCount = 0;
SYSTEMTIME startTime;
try
{
COptions options = COptions::Parse(argc, argv);
if (options.get_Debug())
{
::DebugBreak();
}
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);
}
if (!Utilities::DirectoryExists(options.get_Source()))
{
CString message;
message.AppendFormat(TEXT("Source path is not an existing directory: %s"), options.get_Source());
throw new CShadowSpawnException(message);
}
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("Shadowing %s at %s"),
options.get_Source(),
options.get_Device());
OutputWriter::WriteLine(message, VERBOSITY_THRESHOLD_NORMAL);
GUID systemProviderId = GetSystemProviderID();
OutputWriter::WriteLine(TEXT("Calling CreateVssBackupComponents"));
CHECK_HRESULT(::CreateVssBackupComponents(&pBackupComponents));
OutputWriter::WriteLine(TEXT("Calling InitializeForBackup"));
CHECK_HRESULT(pBackupComponents->InitializeForBackup());
CComPtr<IVssAsync> pWriterMetadataStatus;
OutputWriter::WriteLine(TEXT("Calling GatherWriterMetadata"));
CHECK_HRESULT(pBackupComponents->GatherWriterMetadata(&pWriterMetadataStatus));
OutputWriter::WriteLine(TEXT("Waiting for call to GatherWriterMetadata to finish..."));
CHECK_HRESULT(pWriterMetadataStatus->Wait());
HRESULT hrGatherStatus;
OutputWriter::WriteLine(TEXT("Calling QueryStatus for GatherWriterMetadata"));
CHECK_HRESULT(pWriterMetadataStatus->QueryStatus(&hrGatherStatus, NULL));
if (hrGatherStatus == VSS_S_ASYNC_CANCELLED)
{
throw new CShadowSpawnException(L"GatherWriterMetadata was cancelled.");
}
OutputWriter::WriteLine(TEXT("Call to GatherWriterMetadata finished."));
OutputWriter::WriteLine(TEXT("Calling GetWriterMetadataCount"));
vector<CWriter> writers;
UINT cWriters;
CHECK_HRESULT(pBackupComponents->GetWriterMetadataCount(&cWriters));
//.........这里部分代码省略.........
示例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;
//.........这里部分代码省略.........