Esempio n. 1
0
File: XApp.cpp Progetto: xahgo/tama
void OnPurchaseError( const char *cErr )
{
	if( cErr )
		CONSOLE("XE::OnPurchaseError:%s", C2SZ(cErr) );
	if( GetMain()->GetpGame() )
		GetMain()->GetpGame()->OnPurchaseError( cErr );
}
Esempio n. 2
0
File: XApp.cpp Progetto: xahgo/tama
// 인증서버의 인증결과를 받아옴. xResultAuthen은 범용 구조체
void OnResultLoginAuthen( xRESULT_AUTHEN *pResultAuthen )
{
//		XBREAK( x_pResultAuthen != NULL );
//		x_pResultAuthen = pResultAuthen;
	XBREAK( GetMain()->GetpResultAuthen() != NULL );
	GetMain()->SetpResultAuthen( pResultAuthen );
}
Esempio n. 3
0
File: XApp.cpp Progetto: xahgo/tama
void OnResumeHandler()
{
	XTRACE( "XE::OnResumeHandler()" );
	RestoreDevice();
	if( GetMain() )
		GetMain()->OnResumeHandler();
}
Esempio n. 4
0
KyRefHandle::~KyRefHandle()
{
    DI_ASSERT(GetMain());
    KyObject* pkObj = GetMain()->GetObj(*this);
    if (pkObj)
    {
        pkObj->_DecRefCount();
    }
}
Esempio n. 5
0
KyRefHandle::KyRefHandle(const KyHandle& handle, KyMain* mainContext)
: KyHandle(handle)
, KyMainContext(mainContext)
{
    DI_ASSERT(GetMain());
    KyObject* pkObj = GetMain()->GetObj(*this);
    if (pkObj)
    {
        pkObj->_IncRefCount();
    }
}
KVBatchSystemParametersGUI::KVBatchSystemParametersGUI(const TGWindow* main, KVNameValueList* params, KVDataAnalyser* dan, Bool_t* cancel)
   : KVNameValueListGUI(main, params, cancel, kFALSE), fAnalyser(dan)
{
   // Default constructor
   fJN = (TGTextEntry*)GetDataWidget(GetList()->GetNameIndex("JobName"));
   fJNF = (TGTextEntry*)GetDataWidget(GetList()->GetNameIndex("AutoJobNameFormat"));
   fJNF->SetToolTipText(dan->GetRecognisedAutoBatchNameKeywords());
   fAJN = (TGCheckButton*)GetDataWidget(GetList()->GetNameIndex("AutoJobName"));
   fAJN->Connect("Toggled(Bool_t)", "KVBatchSystemParametersGUI", this, "SetAutoBatchName(Bool_t)");
   fJNF->Connect("TextChanged(const char*)", "KVBatchSystemParametersGUI", this, "UpdateAutoBatchName(const char*)");
   SetAutoBatchName(fAJN->IsDown());

   if (GetList()->HasParameter("MultiJobsMode")) {
      fMJ = (TGCheckButton*)GetDataWidget(GetList()->GetNameIndex("MultiJobsMode"));
      fRPJ = (TGNumberEntry*)GetDataWidget(GetList()->GetNameIndex("RunsPerJob"));
      fRPJ->SetLimits(TGNumberFormat::kNELLimitMinMax, 1, dan->GetNumberOfFilesToAnalyse());
      if (dan->GetNumberOfFilesToAnalyse() < 2) {
         fRPJ->SetState(kFALSE);
         fMJ->SetEnabled(kFALSE);
      }
      else {
         fMJ->Connect("Toggled(Bool_t)", "TGNumberEntry", fRPJ, "SetState(Bool_t)");
         fRPJ->SetState(fMJ->IsDown());
      }
   }
   gClient->WaitFor(GetMain());
}
Esempio n. 7
0
//----------------------------------------------------------------------------------//
void CTradesCache::LoadTrades()
{
	try
	{
		if (static_cast<bool>(m_spTradeChannel))
		{
			BSTR bstrConnectionString;
			if (GetSettingsImpl().get() == NULL)
				utils::ThrowErrorNoSetErrorInfo(E_POINTER, L"Failed to GetSettings.");

			GetSettingsImpl()->GetDBConnection(&bstrConnectionString);
			SetConnectionString(bstrConnectionString);

			HRESULT hr = m_spTradeChannel->put_DatabaseString(bstrConnectionString);

			hr = m_spTradeChannel->LoadTrades(0, GetMain(), VARIANT_FALSE);
			if(FAILED(hr))
				utils::ThrowErrorNoSetErrorInfo(hr, L"Failed to LoadTrades.");
		}
	}
	catch (_com_error& err){
		std::ostringstream out_stream;
		out_stream << "Exception occured while loading trades.";
		TRACE_COM_ERROR(LOG4CPLUS_ERROR, VS::Log, err, std::string(out_stream.str()));	
	}
	catch (...){
		std::ostringstream out_stream;
		out_stream<<"Unknown C++ exception occured while loading trades.";
		TRACE_UNKNOWN_ERROR(LOG4CPLUS_ERROR, VS::Log, std::string(out_stream.str()));
		ATLASSERT(FALSE);
	}
};
Esempio n. 8
0
//--------------------------------------------------------------------------------------------------------
void CController::OnSettingsUpdate(CCalculationSettingsPtr spSettings)
{
	try
	{
		ICalculationSettingsPtr settings = NULL;
		
		GetMain()->get_CalculationSettings(&settings);

		if (static_cast<bool>(settings))
		{
			settings->put_GreeksCalculationMode(static_cast<LONG>(spSettings->GetGreeksCalculationMode()));
			settings->put_GreeksCalculationModel(spSettings->GetGreeksCalculationModel());
			settings->put_UseTimePrecision(spSettings->GetUseTimePrecision() == true ? 1 : 0 );
			settings->put_UseTheoVolaIfNoBid(spSettings->GetUseTheoVolaIfNoBid() == true ? 1 : 0 );
			settings->put_UseTheoVolaIfBadMarketVola(spSettings->GetUseTheoVolaIfBadMarketVola() == true ? 1 : 0 );
			settings->put_PriceTolerance(spSettings->GetPriceTolerance());
			settings->put_PriceRoundingRule(spSettings->GetPriceRoundingRule());
			settings->put_CurveExtrapolationType(spSettings->extrapolation_type());
			settings->put_CurveInterpolationType(spSettings->interpolation_type());
		}
	}
	catch (_com_error&e)
	{
		e.Description();
		ATLASSERT(FALSE);
	};
};
Esempio n. 9
0
//----------------------------------------------------------------------------------//
void CTradesCache::OnTradeUpdate(CTradePtr spTrade)
{
	try{

		if (!m_spSettings->GetProcessTradeForAnalytics()){
			std::ostringstream out_stream;
			out_stream<<"Process trade for analytics is disabled.";
			TRACE_EXECUTION(LOG4CPLUS_INFO, VS::Log, std::string(out_stream.str()))
			return;
		}

		std::ostringstream out_stream;
		out_stream<<"Process trade for analytics. TradeID = " << spTrade->m_nTradeID;
		TRACE_EXECUTION(LOG4CPLUS_INFO, VS::Log, std::string(out_stream.str()))
						
		IContractPtr spContract = GetMain()->GetContract(spTrade->m_nContractID);

		IMmTradeInfoCollPtr spTradesColl = NULL;
		m_spTradeChannel->get_Trd(&spTradesColl);
		if (static_cast<bool>(spTradesColl)){

			IMmTradeInfoAtomPtr spNewTrade = NULL;
			spNewTrade = spTradesColl->Item[spTrade->m_nTradeID];
			if (spNewTrade == NULL)
				spNewTrade = spTradesColl->Add(spTrade->m_nTradeID, spTrade->m_dtTradeDate, NULL);

			spNewTrade->putref_Contract (spContract);
			spTrade->m_spContract = spContract;

			if ( !ProcessTradeForAnalytics(spTrade) ){
				CAutoLock lock(m_ReprocessTradesForAnalyticsLock);
				m_ReprocessTradesForAnalytics.push_back(spTrade);
			}	
		}
	}
Esempio n. 10
0
void CChordEaseApp::WinHelp(DWORD dwData, UINT nCmd) 
{
//printf("dwData=%d:%d nCmd=%d\n", HIWORD(dwData), LOWORD(dwData), nCmd);
	CPathStr	HelpPath(GetAppFolder());
	HelpPath.Append(CString(m_pszAppName) + _T(".chm"));
	HWND	hMainWnd = GetMain()->m_hWnd;
	UINT	ResID = LOWORD(dwData);
	int	HelpID = FindHelpID(ResID);
	HWND	hWnd = 0;	// assume failure
	if (HelpID)	// if context help ID was found
		hWnd = ::HtmlHelp(hMainWnd, HelpPath, HH_HELP_CONTEXT, HelpID);
	if (!hWnd) {	// if context help wasn't available or failed
		hWnd = ::HtmlHelp(hMainWnd, HelpPath, HH_DISPLAY_TOC, 0);	// show contents
		if (!hWnd) {	// if help file not found
			CString	s;
			AfxFormatString1(s, IDS_APP_HELP_FILE_MISSING, HelpPath);
			AfxMessageBox(s);
			return;
		}
	}
	// ThreadBoost DLL boosts priority of MIDI input callbacks, but also boosts
	// other normal threads, including HtmlHelp's, which is counterproductive
	if (m_ThreadBoost.IsLoaded()) {	// if boosting normal priority threads
		DWORD	ThreadID = GetWindowThreadProcessId(hWnd, NULL);
		// obtain set info access to HtmlHelp's thread and set its priority to normal
		CSafeHandle	hThread(OpenThread(THREAD_SET_INFORMATION, FALSE, ThreadID));
		if (hThread == NULL || !::SetThreadPriority(hThread, THREAD_PRIORITY_NORMAL))
			AfxMessageBox(GetLastErrorString());
	}
	m_HelpInit = TRUE;
}
Esempio n. 11
0
void KyRefHandle::_Copy(const KyRefHandle& other)
{
    DI_ASSERT(GetMain());

    KyObject* pkObj = GetMain()->GetObj(*this);
    if (pkObj)
    {
        pkObj->_DecRefCount();
    }

    SetMain(other.GetMain());
    mIndex = other.mIndex;
    mLogicID = other.mIndex;
    mObjectType = other.mObjectType;

    pkObj = GetMain()->GetObj(*this);
    if (pkObj)
    {
        pkObj->_IncRefCount();
    }
}
Esempio n. 12
0
CString CChordEaseApp::GetDataFolderPath()
{
	CString	path(GetMain()->GetOptions().m_DataFolderPath);
	if (path.IsEmpty()) {	// if default data folder
#ifdef PORTABLE_APP	// if portable app
		path = GetAppFolder();	// use app folder
#else	// not portable app
		GetAppDataFolder(path);	// use app data folder
#endif
	}
	return(path);
}
Esempio n. 13
0
File: XApp.cpp Progetto: xahgo/tama
/*	void OnKeyDown( int keyCode, int keyAction )
{
	if( _APP )
		_APP->OnKeyDown( keyCode, keyAction );
} */
void OnPurchaseFinishedConsume( BOOL bGoogle,
								const char *cJson,
								const char *cidProduct, 
								const char *cToken, 
								const char *cPrice,
								const char *cOrderId,
								const char *cTransactDate )
{
	if( cidProduct )
	{
		CONSOLE("XE::OnPurchaseFinishedConsume:%s", C2SZ(cidProduct) );
		if( GetMain()->GetpGame() )
			GetMain()->GetpGame()->OnPurchaseFinishedConsume( bGoogle,
																cJson,
																cidProduct,
																cToken,
																cPrice,
																cOrderId,
																cTransactDate );
	}
}
Esempio n. 14
0
//--------------------------------------------------------------------------------------------------------
void CController::OnUnderlyingUpdate(struct IUnderlyingUpdate* Data)
{
	try
	{
		UNDERLYING_UPDATE_STATUS updStatus;
		Data->get_UpdStatus(&updStatus);
		if (enUndDividendUpdate & updStatus)
			GetMain()->ReloadDividends(Data->GetUndID());

	}
	catch (_com_error&e)
	{
		e.Description();
		ATLASSERT(FALSE);
	};
};
Esempio n. 15
0
bool MakeBuild::Build()
{
	VectorMap<String, String> bm = GetMethodVars(method);
	if(bm.GetCount() == 0) {
		PutConsole("Invalid build method");
		ConsoleShow();
		return false;
	}
	One<Host> host = CreateHost(false);
	One<Builder> builder = CreateBuilder(~host);
	if(!builder)
		return false;
	Index<String> p = PackageConfig(GetIdeWorkspace(), 0, bm, mainconfigparam,
	                                *host, *builder);
	Workspace wspc;
	wspc.Scan(GetMain(), p.GetKeys());
	return Build(wspc, mainconfigparam, Null);
}
Esempio n. 16
0
One<Host> MakeBuild::CreateHost(bool sync_files)
{
	SetupDefaultMethod();
	VectorMap<String, String> bm = GetMethodVars(method);
	One<Host> outhost;
	{
		One<LocalHost> host = new LocalHost;
		VectorMap<String, String> env(Environment(), 1);
		host->exedirs = SplitDirs(bm.Get("PATH", "") + ';' + env.Get("PATH", ""));
		env.GetAdd("PATH") = Join(host->exedirs, ";");
		env.GetAdd("UPP_MAIN__") = GetFileDirectory(PackagePath(GetMain()));
		env.GetAdd("UPP_ASSEMBLY__") = GetVar("UPP");
		for(int i = 0; i < env.GetCount(); i++) {
			LDUMP(env.GetKey(i));
			LDUMP(env[i]);
			host->environment << env.GetKey(i) << '=' << env[i] << '\0';
		}
		host->environment.Cat(0);
		host->cmdout = &cmdout;
		outhost = -host;
	}
	return outhost;
}
Esempio n. 17
0
//--------------------------------------------------------------------------------------------------------//
void CController::LoadAssetList()
{
	try 
	{
		std::vector<CString> __params;
		std::ifstream ContractListFile;

		char* pToken = NULL;
		char* pNextToken = NULL;
		char line[512];
		memset(line, 0, static_cast<size_t>(sizeof(char) * 512));
		char seps[] = ";";

		std::string assetFileName = GetSettingsImpl()->GetAssetListFileName();

		if (assetFileName.length() > 0)
		{
			ContractListFile.open(assetFileName.c_str());

			if (ContractListFile.is_open())
			{
				while (!ContractListFile.eof())
				{
					ContractListFile.getline(line, 256, '\n');

					pToken = strtok_s( line, seps, &pNextToken ); 

					//separate line values
					while( pToken != NULL )
					{
						CString strValue(pToken);
						strValue.TrimLeft().TrimRight();
						__params.push_back(strValue);
						pToken = strtok_s( NULL, seps, &pNextToken );
					};

					if (static_cast<long>(__params.size()) > 1)
					{
						CTicker contract;
						contract.m_enType = static_cast<InstrumentTypeEnum>(-1);

						contract.m_sSymbol = __params[0];
						if (__params[1] == CString("STOCK"))
							contract.m_enType = enSTK;
						else if (__params[1] == CString("INDEX"))
							contract.m_enType = enIDX;

						if (contract.m_enType >= 0 ){
							ITicker ticker;
							contract.CopyTo(ticker);

							GetMain()->LoadContracts(&ticker);

							::SysFreeString(ticker.Symbol);
							::SysFreeString(ticker.Exchange);
						};
					}
					//clear for new line parse
					__params.clear();
				}
			}
			else{
				LOG4CPLUS_WARN(VS::Log, _T("Can't read Asset List file: ") << assetFileName.c_str());	
			}
		}
		else{
			LOG4CPLUS_INFO(VS::Log, _T("Asset List file not defined."));	
		};
	}
	catch (...)
	{
		LOG4CPLUS_ERROR(VS::Log, _T("Unknown exception occured while trying to read Asset List file."));
	};
};
Esempio n. 18
0
void MakeBuild::SaveMakeFile(const String& fn, bool exporting)
{
	BeginBuilding(false, true);

	VectorMap<String, String> bm = GetMethodVars(method);
	One<Host> host = CreateHost(false);
	One<Builder> b = CreateBuilder(~host);
	
	if(!b)
		return;
	
	const TargetMode& tm = GetTargetMode();

	String makefile;

	Vector<String> uppdirs = GetUppDirs();
	String uppout = exporting ? host->GetHostPath(GetVar("OUTPUT")) : "_out/";
	String inclist;

	Index<String> allconfig = PackageConfig(GetIdeWorkspace(), 0, bm, mainconfigparam, *host, *b);
	bool win32 = allconfig.Find("WIN32") >= 0;

	Workspace wspc;
	wspc.Scan(GetMain(), allconfig.GetKeys());

	for(int i = 1; i < wspc.GetCount(); i++) {
		Index<String> modconfig = PackageConfig(wspc, i, bm, mainconfigparam, *host, *b);
		for(int a = allconfig.GetCount(); --a >= 0;)
			if(modconfig.Find(allconfig[a]) < 0)
				allconfig.Remove(a);
	}

	if(!exporting)
		for(int i = 0; i < uppdirs.GetCount(); i++) {
			String srcdir = GetMakePath(AdjustMakePath(host->GetHostPath(AppendFileName(uppdirs[i], ""))), win32);
			makefile << "UPPDIR" << (i + 1) << " = " << srcdir << "\n";
			inclist << " -I$(UPPDIR" << (i + 1) << ")";
		}
	else
		inclist << "-I./";
	Vector<String> includes = SplitDirs(bm.Get("INCLUDE",""));
	for(int i = 0; i < includes.GetCount(); i++)
		inclist << " -I" << includes[i];

	makefile << "\n"
		"UPPOUT = " << (exporting ? "_out/" : GetMakePath(AdjustMakePath(host->GetHostPath(AppendFileName(uppout, ""))), win32)) << "\n"
		"CINC = " << inclist << "\n"
		"Macro = ";

	for(int i = 0; i < allconfig.GetCount(); i++)
		makefile << " -Dflag" << allconfig[i];
	makefile << "\n";

	String output, config, install, rules, linkdep, linkfiles, linkfileend;

	for(int i = 0; i < wspc.GetCount(); i++) {
		b->config = PackageConfig(wspc, i, bm, mainconfigparam, *host, *b);
		b->version = tm.version;
		b->method = method;
		MakeFile mf;
		b->AddMakeFile(mf, wspc[i], GetAllUses(wspc, i),
		               GetAllLibraries(wspc, i, bm, mainconfigparam, *host, *b), allconfig,
		               exporting);
		if(!i) {
			String tdir = mf.outdir;
			String trg;
			if(tm.target_override) {
				trg = GetMakePath(AdjustMakePath(tm.target), win32);
				if(!trg.IsEmpty() && *trg.Last() == (win32 ? '\\' : '/'))
					trg << mf.outfile;
				else if(trg.Find(win32 ? '\\' : '/') < 0)
					trg.Insert(0, "$(OutDir)");
			}
			output = Nvl(trg, mf.output);
			if(exporting)
				output = wspc[i] + ".out";
			install << "\n"
				"OutDir = " << tdir << "\n"
				"OutFile = " << output << "\n"
				"\n"
				".PHONY: all\n"
				"all: prepare $(OutFile)\n"
				"\n"
				".PHONY: prepare\n"
				"prepare:\n";
		}
		config << mf.config;
		install << mf.install;
		rules << mf.rules;
		linkdep << mf.linkdep;
		linkfiles << mf.linkfiles;
		linkfileend << mf.linkfileend;
	}

	makefile
		<< config
		<< install
		<< "\n"
		"$(OutFile): " << linkdep << "\n\t" << linkfiles << linkfileend << " -Wl,--end-group\n\n"
		<< rules
		<< ".PHONY: clean\n"
		<< "clean:\n"
		<< "\tif [ -d $(UPPOUT) ]; then rm -rf $(UPPOUT); fi;\n";

	bool sv = ::SaveFile(fn, makefile);
	if(!exporting)
		if(sv)
			PutConsole(NFormat("%s(1): makefile generation complete", fn));
		else
			PutConsole(NFormat("%s: error writing makefile", fn));

	EndBuilding(true);
}
Esempio n. 19
0
File: XApp.cpp Progetto: xahgo/tama
/**
	구매를 위해 비번까지 입력한 이후 실제 구매요청을 보낸 직후에 호출된다.
	iOS만 적용된다.
	*/
void OnPurchaseStart( const char *cSku )
{
	XTRACE( "XE::OnPurchaseStart");
	if( GetMain()->GetpGame() )
		GetMain()->GetpGame()->OnPurchaseStart( cSku );
}
Esempio n. 20
0
File: XApp.cpp Progetto: xahgo/tama
// 기기에서 홈버튼으로 나갔을때 호출되는 핸들러
void OnPauseHandler()
{
	if( GetMain() )
		GetMain()->OnPauseHandler();
}