bool Config::LoadKey( char *key, int &num ) { long v; // Configuration file must be open if ( NULL == m_fIn ) return false; LoadKey( key, v ); num = v; return true; }
bool MythRAOPConnection::Init(void) { // connect up the request socket m_textStream = new NetStream(m_socket); m_textStream->setCodec("UTF-8"); if (!connect(m_socket, SIGNAL(readyRead()), this, SLOT(readClient()))) { LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to connect client socket signal."); return false; } // create the data socket m_dataSocket = new ServerPool(); if (!connect(m_dataSocket, SIGNAL(newDatagram(QByteArray, QHostAddress, quint16)), this, SLOT(udpDataReady(QByteArray, QHostAddress, quint16)))) { LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to connect data socket signal."); return false; } // try a few ports in case the first is in use m_dataPort = m_dataSocket->tryBindingPort(m_dataPort, RAOP_PORT_RANGE); if (m_dataPort < 0) { LOG(VB_GENERAL, LOG_ERR, LOC + "Failed to bind to a port for data."); return false; } LOG(VB_GENERAL, LOG_INFO, LOC + QString("Bound to port %1 for incoming data").arg(m_dataPort)); // load the private key if (!LoadKey()) return false; // use internal volume control m_allowVolumeControl = gCoreContext->GetNumSetting("MythControlsVolume", 1); // start the watchdog timer to auto delete the client after a period of inactivity m_watchdogTimer = new QTimer(); connect(m_watchdogTimer, SIGNAL(timeout()), this, SLOT(timeout())); m_watchdogTimer->start(10000); m_dequeueAudioTimer = new QTimer(); connect(m_dequeueAudioTimer, SIGNAL(timeout()), this, SLOT(ProcessAudio())); return true; }
bool _XKeyframeController::LoadKey( LPSTR szFilename ) { FILE* pFile; pFile = fopen(szFilename, "rb"); if (pFile == NULL) { return false; } LoadKey(pFile); fclose(pFile); return true; }
DWORD LoadKeys(DWORD appID, const char* path, DWORD* level, BOOL* valid, CPtrArray* array) { DWORD ret=0; struct find_t ffblk; char string[0x200]; char* namePtr=NULL; if(!DATA_Init_Library((void*(*)(unsigned int))Malloc,Free)) return ret; *string=0; //GetFullPathName(path,0x200,string,&namePtr); strncpy(string,path,0x200); namePtr=strrchr(string,'\\'); if(namePtr) namePtr++; else namePtr=string; if(namePtr==NULL)namePtr=string+strlen(string); // strcpy(namePtr,"*.key"); if(_dos_findfirst(string,_A_ARCH|_A_SYSTEM|_A_HIDDEN|_A_RDONLY,&ffblk)==0) { do { if((ffblk.attrib&0x10)==0) //if(0==(FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)) { strcpy(namePtr,ffblk.name);//FindData.cFileName); // if(!strlen(FindData.cFileName)||(DWORD)-1==GetFileAttributes(string)) // { // strcpy(namePtr,FindData.cAlternateFileName); // if(!strlen(FindData.cAlternateFileName)||(DWORD)-1==GetFileAttributes(string)) // continue; // } // ret|=LoadKey(string, array, appID); //#ifdef OLD_KEY_SUPPORT // if(!ret) ret|=LoadOldKey(string,array,appID); //#endif HDATA hRootData=0; BOOL r=LoadKey(appID, string, level, valid, hRootData); #ifdef OLD_KEY_SUPPORT if(!r)r=LoadOldKey(appID, string, level, valid, hRootData); #endif ret|=r; if(hRootData) { int i=0; if(array) { AVP_dword dseq[5]; char key1[0x80]; DATA_Get_Val(hRootData,DATA_Sequence(dseq,AVP_PID_KEYINFO,PID_SERIALSTR,0), 0, key1, 0x80); for(i=array->GetUpperBound();i>=0;i--) { char key2[0x80]; HDATA hKey=(HDATA)array->GetAt(i); if(DATA_Get_Val(hKey, dseq, 0, key2, 0x80)) if(!strcmp(key1,key2)) break; } if(i==-1) array->Add(hRootData); } if(i!=-1) DATA_Remove( hRootData, 0 ); } } }while(_dos_findnext(&ffblk)==0);// FindNextFile(hFind, &FindData)); _dos_findclose(&ffblk); } return ret; }