// ---------------------------------------------------------------------------
// Name:        afInitializeApplicationCommand::executeSpecificCommand
// Description: Implements this class work - Performs required application initializations.
// Return Val: bool  - Success / failure.
// Author:      Yaki Tebeka
// Date:        20/8/2007
// ---------------------------------------------------------------------------
bool afInitializeApplicationCommand::executeSpecificCommand()
{
    bool retVal = false;

    // Set the global product name:
    afGlobalVariablesManager::SetProductName(m_productName);

    // Initialize the un-handled exceptions handler:
    initializeUnhandledExceptionHandler();


    // Initialize the debug log file:
    initializeDebugLogFile();

    // Output an "Application init begin" log printout:
    OS_OUTPUT_DEBUG_LOG(AF_STR_LogMsg_AppInitBegin, OS_DEBUG_LOG_INFO);

    // Create the process debugger event handler:
    afProcessDebuggerEventHandler::instance();

    // Name the application's main thread in Visual Studio's thread's list:
    nameMainThreadInDebugger();

    // Read the Options file:
    loadOptionsFile();

    // Check the OS version:
    bool rc3 = verifyOSVersion();
    GT_IF_WITH_ASSERT(rc3)
    {
        OS_OUTPUT_DEBUG_LOG(AF_STR_LogMsg_AppInitCmdSucceeded, OS_DEBUG_LOG_DEBUG);
    }

    bool rc4 = true;
    // On Linux / Mac only (where we don't have a setup in which the user accepts the EULA):
#if ((AMDT_BUILD_TARGET == AMDT_LINUX_OS) && (AMDT_BUILD_CONFIGURATION != AMDT_DEBUG_BUILD))
    {
        // --------------- EULA ---------------

        // If needed, display EULA dialog:
        rc4 = gdDisplayEULADialog();
    }
#endif

    if (rc4)
    {
#if (AMDT_BUILD_CONFIGURATION != AMDT_DEBUG_BUILD)
        /// NOTICE: Currently, in VS10, web page cannot be initialized when debugging the VS package.
        /// We skip this line as a workaround, to enable the debugging.
        // Initiate Updater to check automatic check for update
        afSoftwareUpdaterWindow dlg;
        dlg.performAutoCheckForUpdate();
#endif
    }

    retVal = rc4;

    GT_RETURN_WITH_ASSERT(retVal);
}
// ---------------------------------------------------------------------------
// Name:        afInitializeApplicationCommand::initializeDebugLogFile
// Description: Initialize the debug log file.
// Return Val:  bool - Success / failure.
// Author:      Yaki Tebeka
// Date:        30/8/2005
// ---------------------------------------------------------------------------
bool afInitializeApplicationCommand::initializeDebugLogFile()
{
    bool retVal = false;

    // Set the thread naming prefix:
    osThread::setThreadNamingPrefix(afGlobalVariablesManager::ProductNameCharArray());

    // Initialize the OS description string:
    initializeSystemInformationData();

    // Initialize the log file:
    osDebugLog& theDebugLog = osDebugLog::instance();
    retVal = theDebugLog.initialize(afGlobalVariablesManager::ProductName(), m_productDescriptionString.asCharArray(), m_systemInformationStr.asCharArray());

    GT_RETURN_WITH_ASSERT(retVal);
}