예제 #1
0
void CGameGUIFileDialog::OnInitDialog()
{
	CGameDialogBase::OnInitDialog();
	if(m_sFile==""){m_sFile=AppendPathSeparator(GetWorkingFolder());}
	if(m_piSTTitle){m_piSTTitle->SetText(m_sTitle);}
	if(m_piEDPath)
	{
		m_piEDPath->SetText(m_sFile);
		m_piEDPath->SetCursor(m_sFile.length());
		m_piGUIManager->SetFocus(m_piEDPath);
	}
	UpdateFiles();
}
예제 #2
0
파일: Utils.cpp 프로젝트: adi97ida/Client
		bool OnFolder(const char* c_szFilter, const char* c_szPathName, const char* c_szFileName)
		{
			std::string strFullPathName;
			strFullPathName = c_szPathName;
			strFullPathName += c_szFileName; 

			CDirRemover remover;
			remover.Create(c_szFilter, strFullPathName.c_str());

			std::string strWorkingFolder;
			GetWorkingFolder(strWorkingFolder);
			strWorkingFolder += strFullPathName;
			strWorkingFolder += "/";
			StringPath(strWorkingFolder);
			ms_strDirectoryDeque.push_back(strWorkingFolder);
			return true;
		}
예제 #3
0
bool ABPLTools::DownloadAndLaunch(Options options)
{
	bool bResult=false;
	CString appLocal = GetWorkingFolder();
	CString server = MakeCanonical(options.m_server);	// Build URL
	// Find application
	CString xmlName[] = { "trayItem.jnlp", "tms_local.jnlp", "retailMonitor.jnlp", "trniviewer.jnlp" };
	ApplicationInfo application;
	CString appName = xmlName[options.m_application];
	application.LoadXML(server + "apps/" + appName);
	//int idx = appName.ReverseFind('/');
	//CString file = appName.Mid(idx+1);
	//tools.DownloadFile(server + "apps/" + appName, appLocal + file);

	std::vector<CString> resources, resources32, resources64, resourcesMac;
	for (int i=0; i<(int)application.m_extension.size(); i++)
	{
		CString thirdParty = DownloadString(server + application.m_extension[i]);
		// tools.DownloadFile(server + application.m_extension[i], appLocal + "thirdParty.xml");
		TiXmlElement* element;
		TiXmlDocument doc1;
		doc1.Parse(thirdParty);
		TiXmlHandle handle0(&doc1);
		int idx=0;
		do
		{
			TiXmlHandle handle1 = handle0.FirstChild("jnlp").Child("resources", idx++);
			element = handle1.ToElement();
			if (element)
			{
				std::vector<CString> *pVector = &resources;
				const char *os = element->Attribute("os");
				const char *arch = element->Attribute("arch");
				const char *family = element->Attribute("family");
				
				if (os)
				{
					if (!strcmp(os, "Windows"))
					{
						if (arch)
						{
							if (!strcmp(arch, "x86"))
								pVector = &resources32;
							else if (!strcmp(arch, "x86_64"))
								pVector = &resources64;
						}
					}

					if (strstr(os, "Mac"))
					{
						pVector = &resourcesMac;
					}

				}
			
				if (!family)
				{
					int idx2=0;
					TiXmlElement* element2;
					do
					{
						element2 = handle1.Child("jar", idx2++).ToElement();
						if (element2)
							pVector->push_back(element2->Attribute("href"));
					}
					while (element2);
				}

			}
		}  while (element);
	}

	std::vector<CString> downloadList;
	std::copy(resources.begin(), resources.end(), std::back_inserter(downloadList));
	std::copy(resources32.begin(), resources32.end(), std::back_inserter(downloadList));
	std::copy(application.m_jars.begin(), application.m_jars.end(), std::back_inserter(downloadList));
	CString fileServer = server;
	fileServer.Replace("/", "_");
	fileServer.Replace(":", "_");
	fileServer.Append("\\");

	ABPDownload download;
	download.m_server = server;
	download.m_basePath = appLocal + fileServer;

	// Download only missing file
	for (std::vector<CString>::iterator it = downloadList.begin(); it != downloadList.end(); it++)
	{
		CString final = download.m_basePath + *it;
		final.Replace("/", "\\");
		DWORD exist = GetFileAttributes(final); // Easy way to see if a file exists
		if (exist==INVALID_FILE_ATTRIBUTES)
			download.m_downloadList.push_back(*it);
	}