Пример #1
0
GLDEF_C void TryUSBMS()
	{
	// Check first whether this boot is intended to load and boot an image from
	// the media.
	if (LoadDevice == EBootUSBMS)
		{
		PrintToScreen(_L("USB-MS boot scanning drives\r\n"));
		// search drives for file - returns true if an image has been found
		if (SearchDrives())
			DoDownload();
		}

	PrintToScreen(_L("Starting USB Mass Storage\r\n"));
	DisableMenu();
	if(StartUSBMS())
		{
		// USB Mass Storage boot has started - don't continue with the
		// bootloader, sleep here.
		while(1)
			User::After(10000000);
		}
	else
		{
		EnableMenu();
		// Not started (probably no card in drive) revert to normal bootloader
		// mode and notify the variant to rewrite it's configuration.
		PrintToScreen(_L("NO VALID MEDIA\r\n"));
		PrintToScreen(_L("Leaving USB Mass Storage mode\r\n"));
		LoadDevice = ELoadDrive;
		WriteConfig();
		}

	return;
	}
Пример #2
0
void CDownloadManager::Run(IContentManager* pContentManager, IPathManager* pPathManager, LPCSTR pszChosenCollection /*=NULL*/)
{
	if (Init(pContentManager, pPathManager))
	{
		CDownloadCollectionArray Collections;
		// Read the list of collections.
		if (GetCollections(Collections))
		{
			// Are there any collections?
			if (Collections.GetSize() == 0)
			{
				// We have no collections. :(
				AfxMessageBox(IDS_NoCollectionsToDownload);
			}
			else
			{
				// We have collections. :)

				// Get the shared directories.
				CMapStringToString mapSharedPaths;
				GetSharedPaths(mapSharedPaths);

				// Compute the default directory to use for downloading.
				CString csDownloadDirectory = GetDownloadDirectory(mapSharedPaths);

				// Get the collection download states.
				UpdateDownloadStates(Collections);

				// Ask the user what to do.
				int iResponse = 0;
				
				while (iResponse = AskUserAboutDownload(Collections, csDownloadDirectory, pszChosenCollection))
				{
					
					if(iResponse == DOWNLOAD)
					{
						
						// Add this download directory to the registry.
						AddDownloadDirectory(mapSharedPaths, csDownloadDirectory);

						// Download the collections.
						DoDownload(Collections, csDownloadDirectory);

						// Get the collection download states.
						UpdateDownloadStates(Collections);
					}
					else if (iResponse == DELETECOLLECTION)
					{
						// Get the collection download states.
						UpdateDownloadStates(Collections);
					}						
				}
			}
		}
	}
}
bool WebResourcesManager::LoadDetectionConfig( const wxString& shortcut, std::vector< char >& content, ProgressHandler* handler )
{
    DetectConfigurationEntry* entry = m_Entries[ shortcut ];
    for ( ; entry ; entry = entry->m_Next )
    {
        if ( DoDownload( entry->m_Url, handler, content ) )
        {
            if ( handler ) handler->JobFinished( handler->idDownloadConfig );
            return true;
        }
    }
    if ( handler ) handler->Error( _("Couldn't download any configuration"), handler->idDownloadConfig );
    return false;
}
Пример #4
0
int CParserDownloader::Start()
{
	VerifyTempFolderExist();

	if(m_connInfo.m_nDlNow <= 0)
	{
		StartConnection();
	}
	else
	{
		m_connInfo.m_nRetry = 0;
		RestartConnection(CCommonUtils::INT_OPER_KEEP, CCommonUtils::MAX_INTEGER);
	}

	return DoDownload();
}
void ServerCliant::readyRead()
{
    if(DownloadStrted==0)
    {
        mCommandBuffer.append(socket->readAll());
        if(mCommandBuffer.endsWith('\n'))
        {
            ProcessCommand(mCommandBuffer);
            mCommandBuffer.clear();
        }
        //qDebug()<<mCommandBuffer;

    }
    else
    {

        DoDownload(socket->readAll());


    }


}
Пример #6
0
bool ProcessCommandLine(int& iRc, HMODULE& hConEmu)
{
	LPCWSTR pszCmdLine = GetCommandLineW();

	// If there is '-new_console' or '-cur_console' switches...
	if (IsNewConsoleArg(pszCmdLine) || IsNewConsoleArg(pszCmdLine, L"-cur_console"))
		return false;

	HeapInitialize();

	bool bProcessed = false;
	// Loop through switches to find supported
	{
		CEStr lsArg;
		int iCount = 0;
		bool bHelpRequested = false;
		bool bFirst = true;
		while (NextArg(&pszCmdLine, lsArg) == 0)
		{
			if ((lsArg.ms_Val[0] == L'-') && lsArg.ms_Val[1] && !wcspbrk(lsArg.ms_Val+1, L"\\//|.&<>^"))
			{
				// Seems this is to be the "switch" too
				lsArg.ms_Val[0] = L'/';
			}

			bool bWasFirst = bFirst; bFirst = false;

			if ((lsArg.ms_Val[0] != L'/') && bWasFirst)
			{
				LPCWSTR pszName = PointToName(lsArg.ms_Val);
				if (pszName && (lstrcmpi(pszName, WIN3264TEST(L"ConEmuC.exe",L"ConEmuC64.exe")) == 0))
					continue;
			}

			iCount++;

			if ((lsArg.ms_Val[0] != L'/') && (iCount > 1))
			{
				// Some unknown (here) switch, goto full version
				break;
			}

			if (lstrcmpi(lsArg, L"/Download") == 0)
			{
				iRc = DoDownload(pszCmdLine);
				// Return '0' on download success for compatibility
				if (iRc == CERR_DOWNLOAD_SUCCEEDED)
					iRc = 0;
				bProcessed = true;
				break;
			}

			if ((lstrcmpi(lsArg, L"/Args") == 0) ||  (lstrcmpi(lsArg, L"/ParseArgs") == 0))
			{
				iRc = DoParseArgs(pszCmdLine);
				bProcessed = true;
				break;
			}

			if ((lstrcmpi(lsArg, L"/?") == 0)
				|| (lstrcmpi(lsArg, L"/h") == 0)
				|| (lstrcmpi(lsArg, L"/help") == 0)
				|| (lstrcmpi(lsArg, L"/-help") == 0)
				)
			{
				bHelpRequested = true;
				break;
			};

			// ToDo: /IsConEmu may be processed partially?

			// TODO: Inject remote and standard, DefTerm
		}

		if (bHelpRequested || (iCount == 0))
		{
			if (!hConEmu)
			{
				// Prefere Help from ConEmuCD.dll because ConEmuC.exe may be outdated (due to stability preference)
				hConEmu = LoadLibrary(WIN3264TEST(L"ConEmuCD.dll",L"ConEmuCD64.dll"));

				// Show internal Help variant if only ConEmuCD.dll was failed to load
				if (hConEmu == NULL)
				{
					Help();
					iRc = CERR_HELPREQUESTED;
					bProcessed = true;
				}
			}
		}
	}

	HeapDeinitialize();

	return bProcessed;
}
bool WebResourcesManager::LoadDetectionConfigurations(const wxArrayString& baseUrls, ProgressHandler* handler )
{
    ClearEntries();

    bool AnyValid = false;

    for ( size_t i=0; i<baseUrls.Count(); i++ )
    {

        wxString listUrl = baseUrls[i];
        wxString baseUrl;
        if ( listUrl.Last() == _T('/') )
        {
            baseUrl = listUrl;
        }
        else
        {
            baseUrl = listUrl.BeforeLast(_T('/'));
            if ( baseUrl.IsEmpty() )
            {
                baseUrl = listUrl;
            }
            baseUrl += _T('/');
        }

        std::vector< char > arr;
        if ( !DoDownload( listUrl, handler, arr ) ) continue;

        TiXmlDocument doc;
        if ( doc.Parse( &arr[0], 0, TIXML_DEFAULT_ENCODING ) )
        {
            if ( doc.RootElement() )
            {
                if ( !strcmp(doc.RootElement()->Value(),"libfinderlist") )
                {
                    TiXmlElement* root = doc.RootElement();
                    for ( TiXmlElement* lib = root->FirstChildElement("library");
                          lib;
                          lib = lib->NextSiblingElement("library") )
                    {
                        wxString ShortCode = wxString( lib->Attribute("short_code"), wxConvUTF8 );
                        wxString FileName  = wxString( lib->Attribute("file_name"),  wxConvUTF8 );
                        wxString DigiSign  = wxString( lib->Attribute("sign"),       wxConvUTF8 );
                        if ( !ShortCode.IsEmpty() && !FileName.IsEmpty() )
                        {
                            DetectConfigurationEntry* entry = new DetectConfigurationEntry;
                            entry->m_Url = baseUrl + FileName;
                            entry->m_Sign = DigiSign;
                            entry->m_Next = m_Entries[ ShortCode ];
                            m_Entries[ ShortCode ] = entry;
                            AnyValid = true;
                            continue;
                        }
                    }

                    continue;
                }
            }
        }
        if ( handler ) handler->Error( _("Invalid data in libraries list in: ") + listUrl, handler->idDownloadList );
    }

    if ( handler ) handler->JobFinished( handler->idDownloadList );
    return AnyValid;
}