/*------------------------------------------------------------------------*/
BOOL HistoryManager::loadFromFile(char *filename)
{

    if (filename)
    {
        char *commentbeginsession = NULL;

        std::string name;
        name.assign(filename);

        if (my_file.loadFromFile(name) == HISTORY_TRUNCATED)
        {
            bTruncated = TRUE;
        }

        CommandsList.clear();
        CommandsList = my_file.getHistory();

        if (CommandsList.size() > 0)
        {
            char *firstLine = getFirstLine();

            if (firstLine)
            {
                if (!isBeginningSessionLine(firstLine))
                {
                    fixHistorySession();
                }
                FREE(firstLine);
                firstLine = NULL;
            }
        }

        /* add date & time @ begin session */
        commentbeginsession = getCommentDateSession(FALSE);
        appendLine(commentbeginsession);
        FREE(commentbeginsession);
        commentbeginsession = NULL;

        CommandHistoryLoadFromFile();

        return TRUE;
    }
    return FALSE;
}
/*------------------------------------------------------------------------*/
BOOL HistoryManager::loadFromFile(char* _pstFilename)
{
    if (_pstFilename)
    {
        char* pstCommentBeginSession = NULL;
        if (m_HF.loadFromFile(_pstFilename) == HISTORY_TRUNCATED)
        {
            m_bTruncated = TRUE;
        }

        m_Commands.clear();
        m_Commands = m_HF.getHistory();

        if (m_Commands.size() > 0)
        {
            char* pstFirstLine = getFirstLine();
            if (pstFirstLine)
            {
                if (!isBeginningSessionLine(pstFirstLine))
                {
                    fixHistorySession();
                }
                FREE(pstFirstLine);
                pstFirstLine = NULL;
            }
        }

        /* add date & time @ begin session */
        pstCommentBeginSession = getCommentDateSession(FALSE);
        appendLine(pstCommentBeginSession);
        FREE(pstCommentBeginSession);
        pstCommentBeginSession = NULL;

        CommandHistoryLoadFromFile();

        return TRUE;
    }
    return FALSE;
}