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

#include <vcl.h>
#pragma hdrstop
#include <tchar.h>
//---------------------------------------------------------------------------
#include "AppGlobalF.h"
#include "ITSDbF.h"
#include "ITSLangTransF.h"

//---------------------------------------------------------------------------
USEFORM("MAIN\FrmCameraScreenF.cpp", FrmCameraScreen);
USEFORM("MAIN\FrmCctvCamViewerF.cpp", FrmCctvCamViewer);
USEFORM("MAIN\FRAME\FRAME_ObjListF.cpp", FRAMEObjList); /* TFrame: File Type */
USEFORM("MAIN\FrmCameraPlayerF.cpp", FrmCameraPlayer);
USEFORM("MAIN\FrmCameraFullScreenF.cpp", FrmCameraFullScreen);
USEFORM("MAIN\FrmCameraScreenManagerF.cpp", FrmCameraScreenManager);
USEFORM("MAIN\FrmInitializeF.cpp", FrmInitialize);
USEFORM("MAIN\FrmCameraInfoF.cpp", FrmCameraInfo);
//---------------------------------------------------------------------------
WINAPI _tWinMain(HINSTANCE, HINSTANCE, LPTSTR, int)
{
    int nLoginRes;

    DateSeparator = '-';
    TimeSeparator = ':';
    ShortDateFormat ="yyyy-MM-dd";
    ShortTimeFormat = "hh:nn:ss";
    LongTimeFormat  = "hh:nn:ss";

    int nRes;
    g_nPid     = (int)GetCurrentProcessId();
    g_sAppDir  = ExtractFilePath(Application->ExeName);
    g_sAppName = ChangeFileExt(ExtractFileName(Application->ExeName), "");
    g_sCfgDir  = g_sAppDir + "Cfg\\";
    g_sLogDir  = g_sAppDir + "Log\\";

    ForceDirectories(g_sCfgDir.c_str());
    //ForceDirectories(g_sLogDir.c_str());

    String sAppDir = ExtractFilePath(Application->ExeName);
    ChDir(sAppDir);

    /*
    *  시스템 운영환경을 ini 파일에서 읽어 온다.
    */
    LoadDefaultConfigInfo("");

    //ITSLog = new TITSLog(g_sLogDir, g_sAppName, g_AppCfg.sLogDay);
    //ITSLog->FLogCfg = g_LogCfg;

    try
    {
        ReportMemoryLeaksOnShutdown = true;
        Application->Initialize();
        Application->MainFormOnTaskBar = true;
        Application->Title = g_AppCfg.sTitle;
        Application->Title = "카메라 영상 모니터링";
         Application->CreateForm(__classid(TFrmCctvCamViewer), &FrmCctvCamViewer);
         Application->Run();
    }
    catch (Exception &exception)
    {
         Application->ShowException(&exception);
    }
    catch (...)
    {
         try
         {
             throw Exception("");
         }
         catch (Exception &exception)
         {
             Application->ShowException(&exception);
         }
    }

prog_exit:
    try
    {
    }
    catch(...)
    {
    }

    return 0;
}
//---------------------------------------------------------------------------

