bool NetscapePluginModule::getPluginInfo(const String& pluginPath, PluginInfoStore::Plugin& plugin)
{
        String pathCopy = pluginPath;
    DWORD versionInfoSize = ::GetFileVersionInfoSizeW(pathCopy.charactersWithNullTermination(), 0);
    if (!versionInfoSize)
        return false;

    OwnArrayPtr<char> versionInfoData = adoptArrayPtr(new char[versionInfoSize]);
    if (!::GetFileVersionInfoW(pathCopy.charactersWithNullTermination(), 0, versionInfoSize, versionInfoData.get()))
        return false;

    String name = getVersionInfo(versionInfoData.get(), "ProductName");
    String description = getVersionInfo(versionInfoData.get(), "FileDescription");
    if (name.isNull() || description.isNull())
        return false;

    VS_FIXEDFILEINFO* info;
    UINT infoSize;
    if (!::VerQueryValueW(versionInfoData.get(), L"\\", reinterpret_cast<void**>(&info), &infoSize) || infoSize < sizeof(VS_FIXEDFILEINFO))
        return false;

    Vector<String> types;
    getVersionInfo(versionInfoData.get(), "MIMEType").split('|', types);
    Vector<String> extensionLists;
    getVersionInfo(versionInfoData.get(), "FileExtents").split('|', extensionLists);
    Vector<String> descriptions;
    getVersionInfo(versionInfoData.get(), "FileOpenName").split('|', descriptions);

    Vector<MimeClassInfo> mimes(types.size());
    for (size_t i = 0; i < types.size(); i++) {
        String type = types[i].lower();
        String description = i < descriptions.size() ? descriptions[i] : "";
        String extensionList = i < extensionLists.size() ? extensionLists[i] : "";

        Vector<String> extensionsVector;
        extensionList.split(',', extensionsVector);

        // Get rid of the extension list that may be at the end of the description string.
        int pos = description.find("(*");
        if (pos != -1) {
            // There might be a space that we need to get rid of.
            if (pos > 1 && description[pos - 1] == ' ')
                pos--;
            description = description.left(pos);
        }

        mimes[i].type = type;
        mimes[i].desc = description;
        mimes[i].extensions.swap(extensionsVector);
    }

    plugin.path = pluginPath;
    plugin.info.desc = description;
    plugin.info.name = name;
    plugin.info.file = pathGetFileName(pluginPath);
    plugin.info.mimes.swap(mimes);
    plugin.fileVersion = fileVersion(info->dwFileVersionLS, info->dwFileVersionMS);

    return true;
}
示例#2
0
bool PluginPackage::fetchInfo()
{
    DWORD versionInfoSize, zeroHandle;
    versionInfoSize = GetFileVersionInfoSizeW(m_path.charactersWithNullTermination(), &zeroHandle); 
    if (versionInfoSize == 0)
        return false;

    OwnArrayPtr<char> versionInfoData(new char[versionInfoSize]);

    if (!GetFileVersionInfoW(m_path.charactersWithNullTermination(), 0, versionInfoSize, versionInfoData.get()))
        return false;

    m_name = getVersionInfo(versionInfoData.get(), "ProductName");
    m_description = getVersionInfo(versionInfoData.get(), "FileDescription");
    if (m_name.isNull() || m_description.isNull())
        return false;

    VS_FIXEDFILEINFO* info;
    UINT infoSize;
    if (!VerQueryValue(versionInfoData.get(), TEXT("\\"), (LPVOID*) &info, &infoSize) || infoSize < sizeof(VS_FIXEDFILEINFO))
        return false;
    m_moduleVersion.leastSig = info->dwFileVersionLS;
    m_moduleVersion.mostSig = info->dwFileVersionMS;

    if (isPluginBlacklisted())
        return false;

    Vector<String> types;
    getVersionInfo(versionInfoData.get(), "MIMEType").split('|', types);
    Vector<String> extensionLists;
    getVersionInfo(versionInfoData.get(), "FileExtents").split('|', extensionLists);
    Vector<String> descriptions;
    getVersionInfo(versionInfoData.get(), "FileOpenName").split('|', descriptions);

    for (unsigned i = 0; i < types.size(); i++) {
        String type = types[i].lower();
        String description = i < descriptions.size() ? descriptions[i] : "";
        String extensionList = i < extensionLists.size() ? extensionLists[i] : "";

        Vector<String> extensionsVector;
        extensionList.split(',', extensionsVector);

        // Get rid of the extension list that may be at the end of the description string.
        int pos = description.find("(*");
        if (pos != -1) {
            // There might be a space that we need to get rid of.
            if (pos > 1 && description[pos - 1] == ' ')
                pos--;
            description = description.left(pos);
        }

        // Determine the quirks for the MIME types this plug-in supports
        determineQuirks(type);

        m_mimeToExtensions.add(type, extensionsVector);
        m_mimeToDescriptions.add(type, description);
    }

    return true;
}
    void paint (Graphics& g)
    {
        g.setColour (findColour (mainBackgroundColourId).contrasting (0.3f));

        Rectangle<int> r (getLocalBounds());

        g.setFont (15.0f);
        g.drawFittedText (getVersionInfo(), r.removeFromBottom (50), Justification::centredBottom, 3);

        logo->drawWithin (g, r.withTrimmedBottom (r.getHeight() / 4).toFloat(),
                          RectanglePlacement (RectanglePlacement::centred), 1.0f);
    }
// --------------------------------------------------------------------------
// ARDrone::open(IP address of AR.Drone)
// Description  : Initialize the AR.Drone.
// Return value : SUCCESS: 1  FAILURE: 0
// --------------------------------------------------------------------------
int ARDrone::open(const char *ardrone_addr)
{
    // Initialize FFmpeg
    av_register_all();
    avformat_network_init();
    av_log_set_level(AV_LOG_QUIET);

    // Save IP address
    strncpy(ip, ardrone_addr, 16);

    // Get version information
    if (!getVersionInfo()) return 0;
    printf("AR.Drone Ver. %d.%d.%d\n", version.major, version.minor, version.revision);

	//// getVersionInfo() takes too long before realising the drone is not connected
	//// it call tcp open, which makes a socket and tries to connect to it
	//// using the connect method, which has too big of a timeout.
	//// making a smaller, 5 sec timeout before checking the verison to see if drone connected.
	//// if not, return 0
	//if (!version.major) {
	//	// create timeout and wait 5 sec
	//	printf("Waiting for drone to connect...\n");
	//	msleep(5000);
	//	// check again
	//	if (!version.major) return 0;
	//}

    // Initialize AT command
    if (!initCommand()) return 0;

    // Initialize Navdata
    if (!initNavdata()) return 0;

    // Initialize Video
    if (!initVideo()) return 0;

    // Wait for updating state
    //msleep(500);

    // Get configurations
    if (!getConfig()) return 0;

    // Reset emergency
    resetWatchDog();
    resetEmergency();

    return 1;
}
/**
 * Supported options are '-h', '-v'.
 * @throws HelpException when only help is need
 * @throws LogicException when used option is unknown
 */
    void
OptionAgent::parseDashOpt(const std::string &arg,
        const OptionParams &params)
{
    if ("-h" == arg || "--help" == arg) {
        throw HelpException(ExInfo(getHelpInfo(params)));
    }
    else if ("-v" == arg || "--version" == arg) {
        throw HelpException(ExInfo(getVersionInfo()));
    }
    else if ("-c" == arg || "--config" == arg) {
        throw HelpException(ExInfo(params.getConfig(m_environ)));
    }
    else {
        throw LogicException(ExInfo("unknown option")
                .addInfo("arg", arg)
                .addInfo("use",
                    getParam("program") + " --help"));
    }
}
示例#6
0
// --------------------------------------------------------------------------
// ARDrone::open(IP address of AR.Drone)
// Description  : Initialize the AR.Drone.
// Return value : SUCCESS: 1  FAILURE: 0
// --------------------------------------------------------------------------
int ARDrone::open(const char *ardrone_addr)
{
    #if _WIN32
    // Initialize WSA
    WSAData wsaData;
    WSAStartup(MAKEWORD(1,1), &wsaData);
    #endif

    // Initialize FFmpeg
    av_register_all();
    avformat_network_init();
    av_log_set_level(AV_LOG_QUIET);

    // Save IP address
    strncpy(ip, ardrone_addr, 16);

    // Get version information
    if (!getVersionInfo()) return 0;
    printf("AR.Drone Ver. %d.%d.%d\n", version.major, version.minor, version.revision);

    // Get configurations
    if (!getConfig()) return 0;

    // Initialize AT command
    if (!initCommand()) return 0;

    // Initialize Navdata
    if (!initNavdata()) return 0;

    // Initialize Video
    if (!initVideo()) return 0;

    // Wait for updating state
    msleep(500);

    // Reset emergency
    resetWatchDog();
    resetEmergency();

    return 1;
}
示例#7
0
// --------------------------------------------------------------------------
// ARDrone::open(IP address of AR.Drone)
// Description  : Initialize the AR.Drone.
// Return value : SUCCESS: 1  FAILURE: 0
// --------------------------------------------------------------------------
int ARDrone::open(const char *ardrone_addr)
{
    // Initialize WSA
    WSAData wsaData;
    WSAStartup(MAKEWORD(1,1), &wsaData);

    // Save IP address
    strncpy(ip, ardrone_addr, 16);

    // Get version informations
	// version.major = 2;
    if (!getVersionInfo()) return 0;
    
	printf("AR.Drone Ver. %d.%d.%d\n", version.major, version.minor, version.revision);

    // Initialize AT Command
    // if (!initCommand()) return 0;

    // Initialize Config
    if (!initConfig()) return 0;

    // Initialize Navdata
    // if (!initNavdata()) return 0;

    // Initialize Video
    if (!initVideo()) return 0;

    // Wait for updating state
    Sleep(500);

    // Reset emergency
    // resetWatchDog();
    // resetEmergency();

    return 1;
}
示例#8
0
 bool SelfUpdater::updateAvailable()
 {
     versionInfo = getVersionInfo();
     return versionInfo["update_available"].toBool();
 }
示例#9
0
int main(int argc, char *argv[])
{
  char cBufRead[BUF_SIZE];
  DWORD dwBytesRead;
  FT_STATUS ftStatus;
  FT_HANDLE ftHandle;
  int iport;
  int i;
  char c;
  
  if(argc > 1) {
    sscanf(argv[1], "%d", &iport);
  }
  else {
    iport = 0;
  }
  
  // Note!
  // The second version of open should work from version 0.4.9 it may be prefered
  // in many situations. On Fedora Core 4, kernal 2.6.15 it fails however.
  //ftStatus = FT_Open(iport, &ftHandle);
  ftStatus = FT_OpenEx( "LWO65RKA", FT_OPEN_BY_SERIAL_NUMBER, &ftHandle);
  //ftStatus = FT_OpenEx( NULL, FT_OPEN_BY_SERIAL_NUMBER, &ftHandle); // First found
  if(ftStatus != FT_OK) {
    /* 
       This can fail if the ftdi_sio driver is loaded
       use lsmod to check this and rmmod ftdi_sio to remove
       also rmmod usbserial
    */
    printf("FT_Open(%d) failed. rv=%d\n", iport, ftStatus);
    return 1;
  }

  FT_SetTimeouts(ftHandle, 3000, 3000 );       // 3 second read timeout
     
  while ( 1 ) {
    
    printf("\n\n\n");
    printf("=====================================================================\n");
    printf("               Lawicel AB -- CANUSB test application\n");
    printf("=====================================================================\n\n");
   
    printf("S - Send test frames.\n");
    printf("R - Read five frames.\n");
    printf("N - Get Serial number.\n");
    printf("V - Get Version Information.\n");
    printf("Q - Quit application.\n");
   
    while ( 0x0a == ( c = getchar() ));

    if ( 'q' == c || 'Q' == c ) break;
    else if ( 'v' == c || 'V' == c  ){
      getVersionInfo( ftHandle );
    }
    else if ( 'n' == c || 'N' == c  ){
      getSerialNumber( ftHandle );
    }
    else if ( 's' == c || 'S' == c  ){
      SendTestFrames( ftHandle );
    }
    else if ( 'r' == c || 'R' == c  ){
      GetTestFrames( ftHandle );
    }
  }
	
  printf("Bye,bye....\n");
  FT_Close(ftHandle);
  return 0;
}
示例#10
0
	eAboutScreen()
	{
		/* help text for about screen */
		setHelpText(_("\tAbout...\n\n>>> [MENU] >>> [4] Information >>> About...\n. . . . . . . . . .\n\n" \
									"Provides information about your Dreambox, like model, CPU, harddisk(s), software version, skin, etc.\n" \
									". . . . . . . . . .\n\nUsage:\n\n[GREEN]/[OK]/[EXIT]\tClose window"));

		machine=new eLabel(this);
		machine->setName("machine");

		vendor=new eLabel(this);
		vendor->setName("vendor");

		processor=new eLabel(this);
		processor->setName("processor");

		frontend=new eLabel(this);
		frontend->setName("frontend");

		harddisks=new eLabel(this);
		harddisks->setName("harddisks");

		okButton=new eButton(this);
		okButton->setName("okButton");

		dreamlogo=new eLabel(this);
		dreamlogo->setName("dreamlogo");

		triaxlogo=new eLabel(this);
		triaxlogo->setName("triaxlogo");

		version=new eLabel(this);
		version->setName("version");

		fpversion=new eLabel(this);
		fpversion->setName("fp_version");

		if (eSkin::getActive()->build(this, "eAboutScreen"))
			eFatal("skin load of \"eAboutScreen\" failed");

		dreamlogo->hide();
		triaxlogo->hide();
		
		if ( !eSystemInfo::getInstance()->hasHDD() )
		{
			harddisks->hide();
			eWidget *h=search("harddisk_label");
			if(h)
				h->hide();
		}

		machine->setText(eSystemInfo::getInstance()->getModel());
		vendor->setText(eSystemInfo::getInstance()->getManufacturer());
		processor->setText(eString().sprintf("Processor: %s", eSystemInfo::getInstance()->getCPUInfo()));

		switch (eSystemInfo::getInstance()->getFEType())
		{
			case eSystemInfo::feSatellite:
				frontend->setText(_("Frontend: Satellite"));
				break;
			case eSystemInfo::feCable:
				frontend->setText(_("Frontend: Cable"));
				break;
			case eSystemInfo::feTerrestrial:
				frontend->setText(_("Frontend: Terrestrial"));
				break;
			default:
				frontend->setText(_("Frontend: Unknown"));
		}

		eString sharddisks;
#ifndef DISABLE_FILE
		sharddisks = getDiskInfo(0);
#else
		sharddisks=_("none");
#endif //DISABLE_FILE
		harddisks->setText(sharddisks);

		{
			eString verid=getVersionInfo("version");
			if (!verid)
				version->setText(_("unknown"));
			else
			{
				if (eSystemInfo::getInstance()->isOpenEmbedded())
				{
					int length = verid.length();
					eString ver=verid.mid(1, length - 13);
					eString date=verid.mid(length - 12, 8);
					version->setText(eString(ver + eString(" ") + date.left(4) + "-" + date.mid(4, 2) + "-" + date.mid(6,2)));
				}
				else
				{
					int type=atoi(verid.left(1).c_str());
					char *typea[3];
					typea[0]=_("release");
					typea[1]=_("beta");
					typea[2]=_("internal");
					eString ver=verid.mid(1, 3);
					eString date=verid.mid(4, 8);
	//				eString time=verid.mid(12, 4);
					if ( eSystemInfo::getInstance()->getHwType() == eSystemInfo::DM7000 )
						version->setText(
							eString(typea[type%3]) + eString(" ") + ver[0] + "." + ver[1] + "." + ver[2]
								+ ", " + date.mid(6, 2) + "." + date.mid(4,2) + "." + date.left(4));
					else
						version->setText(
							eString().sprintf("%s %c.%d. %s", typea[type%3], ver[0],
								atoi( eString().sprintf("%c%c",ver[1],ver[2]).c_str()),
								(date.mid(6, 2) + "." + date.mid(4,2) + "." + date.left(4)).c_str())
								);
				}
			}
		}

		if ( !strcmp(eSystemInfo::getInstance()->getManufacturer(),"Triax") )
			triaxlogo->show();
		else if ( !strcmp(eSystemInfo::getInstance()->getManufacturer(),"Dream-Multimedia-TV") )
			dreamlogo->show();

		if ( eSystemInfo::getInstance()->getHwType() == eSystemInfo::DM7000
			|| eSystemInfo::getInstance()->getHwType() == eSystemInfo::DM7020)
		{
			eString fp_version = fpversion->getText();
			fp_version += eString().sprintf(" 1.%02d", eDreamboxFP::getFPVersion());
			eDebug("%s", fp_version.c_str());
			fpversion->setText(fp_version);
		} 
		else
			fpversion->hide();

		CONNECT(okButton->selected, eWidget::accept);
	}