//---------------------------------------------------------------------------


#pragma hdrstop

#include "CommFlashF.h"

//---------------------------------------------------------------------------

#pragma package(smart_init)

TCommFlash::TCommFlash()
{
}
//---------------------------------------------------------------------------
TCommFlash::~TCommFlash()
{
}
//---------------------------------------------------------------------------

bool TCommFlash::CallFunc(TShockwaveFlashEx *ShockwaveFlash1, String AFuncName, String AArgs)
{
    try
    {
        String sCommand;
        sCommand.sprintf((L"<invoke name=\"%s\"><arguments><string>%s</string></arguments></invoke>"), AFuncName, AArgs);
        ShockwaveFlash1->CallFunction(sCommand);
    }
    catch (Exception &exception)
    {
        //throw Exception(String(exception.ClassName()) + exception.Message);
        return false;
    }
    return true;
}
//---------------------------------------------------------------------------

String TCommFlash::ReplaceName(String AName)
{
    String sReturn;
    sReturn = StringReplace(AName,   "<", "[", TReplaceFlags() << rfReplaceAll);
    sReturn = StringReplace(sReturn, ">", "]", TReplaceFlags() << rfReplaceAll);
    sReturn = StringReplace(sReturn, ",", "^", TReplaceFlags() << rfReplaceAll);
    sReturn = StringReplace(sReturn, "$", "^", TReplaceFlags() << rfReplaceAll);

    return sReturn;
}
//---------------------------------------------------------------------------

