Beispiel #1
0
int Redirect_List(const char* path, void* buffer, fuse_fill_dir_t filler, off_t offset, struct fuse_file_info* file_info) {
    const char* userPath = UserDir();
    List* L;
    if(userPath == NULL) {
        L = ListFiles(rootDir, path);
    } else {
        List* lists[3];
        lists[0] = ListFiles(userPath, path);
        lists[1] = ListFiles(rootDir, path);
        lists[2] = NULL;
        free((void*)userPath);
        L = join_lists(lists);
    }
    for (int i=0; i<L->length; i++) {
        struct stat st;
        memset(&st, 0, sizeof(st));
        if(stat(L->str[i], &st) == -1) {
            List_free(L);
            return -errno;
        }
        const char* name = last_term(L->str[i]);
        int result = filler(buffer, name, &st, 0);
        free((void*)name);
        if(result != 0) break;
    }
    List_free(L);
    return 0;
}
Beispiel #2
0
int main(int argc, char **argv)
{
    if (argc == 1) 
      {ListFiles(".");}
    else
      {ListFiles(argv[1]);}

  return(0);
}
Beispiel #3
0
void simulationOERRW::fusionPack(double d,int64 end)
{
    out << "\n\n\n***** PACK FUSION *****\n\n";
    std::string outf1,outf2;
    std::string filename = "pack_OERRW-d" + doubletostring_nice(d) + "-R" + tostring(end);
    {
        std::vector<std::string> listf;
        bool r =  ListFiles(".\\",filename + ".no*.trace.extab",listf,false,true,false);
        if ((!r)||(listf.size() < 2)) {
            out << "Pas de fichiers multiple trouvés (" << filename <<  ".no*.trace.extab)\n";
            return;
        }
        else
        {
            out << "reading " << listf[0] << "\n";
            ExTab me(listf[0]) ;
            for(int i=1; i<(int)listf.size(); i++)
            {
                out << "reading " << listf[i] << "\n";
                ExTab mp(listf[i]);
                me+=mp;
            }
            me /= ((double)listf.size());
            outf1 = filename + ".average" + tostring(listf.size()) + ".trace.extab";
            me.Save(outf1);
            out << "\n" << listf.size() << " files founds.\n\n";
        }
        out << "file saved for the average time of increase of range\n  -> " << outf1 << "\n\n";
    }
    {
        std::vector<std::string> listf;
        bool r =  ListFiles(".\\",filename + ".no*.return.extab",listf,false,true,false);
        if ((!r)||(listf.size() < 2)) {
            out << "Pas de fichiers multiple trouvés (" << filename <<  ".no*.return.extab)\n";
            return;
        }
        else
        {
            out << "reading " << listf[0] << "\n";
            ExTab me(listf[0]) ;
            for(int i=1; i<(int)listf.size(); i++)
            {
                out << "reading " << listf[i] << "\n";
                ExTab mp(listf[i]);
                me+=mp;
            }
            me /= ((double)listf.size());
            outf2 = filename + ".average" + tostring(listf.size()) + ".return.extab";
            me.Save(outf2);
            out << "\n" << listf.size() << " files founds.\n\n";
        }
        out << "file saved for the average number of returns w.r.t. the range\n  -> " << outf2 << "\n\n";
    }
    out << "\n***** PACK FUSION COMPLETED *****\n\n";
    return;
}
void SkydriveService::ListFilesFinished(QNetworkReply* reply) {
  reply->deleteLater();
  QJson::Parser parser;
  QVariantMap response = parser.parse(reply).toMap();

  QVariantList files = response["data"].toList();
  for (const QVariant& f : files) {
    QVariantMap file = f.toMap();
    if (file["type"].toString() == "folder") {
      ListFiles(file["id"].toString());
    } else {
      QString mime_type = GuessMimeTypeForFile(file["name"].toString());
      QUrl url;
      url.setScheme("skydrive");
      url.setPath(file["id"].toString());

      Song song;
      song.set_url(url);
      song.set_ctime(file["created_time"].toDateTime().toTime_t());
      song.set_mtime(file["updated_time"].toDateTime().toTime_t());
      song.set_comment(file["description"].toString());
      song.set_filesize(file["size"].toInt());
      song.set_title(file["name"].toString());

      QUrl download_url = file["source"].toUrl();
      // HTTPS appears to be broken somehow between Qt & Skydrive downloads.
      // Fortunately, just changing the scheme to HTTP works.
      download_url.setScheme("http");
      MaybeAddFileToDatabase(song, mime_type, download_url, QString::null);
    }
  }
}
Beispiel #5
0
void simulationOERRW::packSimulation(double delta,int64 end)
{
    out << "\n\n\n***** PACK SIMULATION *****\n\n";
    std::string filename = "pack_OERRW-d" + doubletostring_nice(delta) + "-R" + tostring(end) + ".no";
    int64 N = 1;
    std::vector<std::string> listf;
    bool r =  ListFiles(".\\",filename + "*.trace.extab",listf,false,true,false);
    if ((r)&&(listf.size()!=0)) {
        N+= (int64)listf.size();
        out << "- " << listf.size() << " previous simulation found. Continuing from there.\n\n";
    }
    else {
        out << "New pack of simulation, starting from scratch.\n\n";
    }
    while(1)
    {
        out << "Simulation No " << N << "\nin progress";
        simpleOERRW w(delta,100000,100000);
        int64 inc = end/50;
        int64 todo = end;
        while(todo >= inc) {
            w.makeWalk(inc);
            out << ".";
            todo -= inc;
        }
        if (todo != 0) {
            w.makeWalk(todo);
            out << ".";
        }
        w.getRangeTab()->Save(filename + tostring(N) + ".trace.extab");
        w.getReturnTab()->Save(filename + tostring(N) + ".return.extab");
        out << "ok!\n\n" << w.info() << "\n\n";
        N++;
    }
}
Beispiel #6
0
int main(int argc, char *argv[])
{
	TCHAR path[MAXPATH];
	BOOL bRecursive = FALSE, bAll = FALSE;
	int i;

	if(argc < 2 || argc > 4) {
		printf("\nUsage: %s <directory name>"
			   "\n\t-R -recursive\n\t-a all atributes\n", argv[0]);
		return (-1);
	}

	/* Parse input line */
	for (i = 1; i < argc; i++){
		if (strcmp(argv[i], "-a") == 0) {
			bAll = TRUE;
			continue;
		}
		if (strcmp(argv[i], "-R") == 0) {
			bRecursive = TRUE;
			continue;
		}

		/* save path */
		strcpy_s(path, MAXPATH, argv[i]);
	}
	
	ListFiles(path, bRecursive, bAll);

	return 0;
}
Beispiel #7
0
int GetDir(char *Wild)
{
  struct ffblk fblock;
  int letzter;
/*  int k; */
  Dateien=0; Datai=Da;

  strcpy(WildCard,Wild);
  letzter=findfirst("*.*",&fblock,16);
  while (!letzter || Dateien>=500) {
    if (fblock.ff_attrib==16) {
      if (fblock.ff_name[0]==46 && strlen(fblock.ff_name)==1) {
	;
      } else {
	strcpy(Datai->FileName,fblock.ff_name);
	Datai->Date=0; Dateien++; Datai++;
      }
    }
    letzter=findnext(&fblock);
  }
  letzter=findfirst(Wild,&fblock,0);
  while (!letzter || Dateien>=500) {
	 strcpy(Datai->FileName,fblock.ff_name);
    Datai->Date=(long)fblock.ff_fdate*100000; Datai->Date+=(long)fblock.ff_ftime;
    Dateien++; Datai++;
    letzter=findnext(&fblock);
  }
  Datai=Da; CWeg();
  if (Dateien==0) return -1;
  qsort(Datai,Dateien,sizeof(Datdings),SortIt); ListFiles();
  return 0;
}
Beispiel #8
0
//Reload
bool Profiles::Reload ()
{
    Err fErr (m_Err, L"Reload");
    if (m_sDirectory.empty ())
    {
        return fErr.Set (L"Profilesystem is not initialized");
    }

    std::vector<wstring> lsFiles;
    if (!ListFiles (m_sDirectory, &lsFiles))
    {
        return fErr.Set (L"Could not list the profiles");
    }

    m_lProfiles.clear ();
    for (unsigned int i = 0; i != lsFiles.size (); i++)
    {
        if (!AddProfile (lsFiles.at (i)))
        {
            return false;
        }
    }

    return true;
}//Reload
// SD Card List Files Command
void cmd_ls(char *param)
{  
  INT8U i       = 0;
  INT8U retorno = 0;  
  INT8U name1[(CONSOLE_BUFFER_SIZE/2)]; //vetor para a leitura dos nomes dos arquivos  
  
  
  (void)*param;
  for(i=0;i<(CONSOLE_BUFFER_SIZE/2);i++)
  {
    // Limpa o buffer de entradas
    name1[i] = 0;
  }  

  retorno = API_COMMAND_OK;
  if(retorno==API_COMMAND_OK)
  {
    (void)ListFiles(name1);
  }
  else
  {
	  printSer(USE_USB, (CHAR8*)SD_API_FILE_INVALID);
  }
  
  for(i=0;i<CONSOLE_BUFFER_SIZE;i++)
  {
    // Limpa o buffer de entradas
    entradas[i] = 0;
  }  
}
void Dlg_GameLibrary::ReloadGameListData()
{
	ClearTitles();

	TCHAR sROMDir[1024];
	GetDlgItemText(m_hDialogBox, IDC_RA_ROMDIR, sROMDir, 1024);

	mtx.lock();
	while (FilesToScan.size() > 0)
		FilesToScan.pop_front();
	mtx.unlock();

	bool bOK = ListFiles(Narrow(sROMDir), "*.bin", FilesToScan);
	bOK |= ListFiles(Narrow(sROMDir), "*.gen", FilesToScan);

	if (bOK)
	{
		std::thread scanner(&Dlg_GameLibrary::ThreadedScanProc);
		scanner.detach();
	}
}
Beispiel #11
0
//InitMenuGame
bool Menu::InitMenuGame ()
{
    Err fErr (m_Err, L"InitMenuGame");

    wstring sLevelDir, sMenuGame, sLevel, sPlay, sCurLevel;
    if (!m_pLanguage->Get (L"GameTitle", &sMenuGame) ||
        !m_pLanguage->Get (L"GameLevel", &sLevel) ||
        !m_pLanguage->Get (L"GamePlay", &sPlay) ||
        !m_pConfig->Get (sCONF_LEVELFILE, &sCurLevel))
    {
        return false;
    }

    std::vector<wstring> lsLevels;
    if (!ListFiles (m_sLevelDir, &lsLevels))
    {
        return fErr.Set (L"Could not list levels");
    }
    if (lsLevels.size () == 0)
    {
        return fErr.Set (L"There are no levels omg");
    }
    int nCurLevel = -1;
    for (unsigned int i = 0; i != lsLevels.size (); i++)
    {
        if (lsLevels.at (i) == sCurLevel)
        {
            nCurLevel = i;
        }
        if (!FilterExtension (lsLevels.at (i), &lsLevels.at (i)))
        {
            return fErr.Set (L"Could not extract the level name");
        }
    }
    if (nCurLevel == -1)
    {
        fErr.Set (L"The preset level file does not exists");
        nCurLevel = 0;
    }

    if (!m_ScreenGame.Init (&m_Err, m_pProfiles, m_pWindow, sMenuGame) ||
        !m_ScreenGame.AddList (sLevel, Vector2f (100, 150), lsLevels,
                               nCurLevel, eGameListLevels) ||
        !m_ScreenGame.AddButton (sPlay, Vector2f (700, 540), eGameButtonPlay) ||
        !m_ScreenGame.AddButton (m_sAbort, Vector2f (700, 600),
                                 eGameButtonAbort))
    {
        return false;
    }

    return true;
}//InitMenuGame
Beispiel #12
0
//新版的配置文件?
void ALMRunConfig::ConfigCommand()
{
	if (!conf)
		return;
	wxString name;
	wxString key;
	wxString cmd;
	wxString desc;
	wxString cmds;
	long cmdId;
	long index = 0;
	//命令
	conf->SetPath("/cmds");
	for(bool test = conf->GetFirstGroup(cmds,index); test ; conf->SetPath("../"),test = conf->GetNextGroup(cmds,index))
    {
		if (!cmds.IsNumber())
			continue;
		conf->SetPath(cmds);
		cmd = conf->Read("cmd");
		if (cmd.empty() && key.empty())
			continue;
		name = conf->Read("name");
		key = conf->Read("key");
		desc = conf->Read("desc");
		cmds.ToLong(&cmdId,10);
		//if (cmdId < 1000 && cmdId > lastId)
		//	lastId = cmdId + 1;
		this->AddCmd(cmd,name,key,desc,cmdId);
    }
	//自动扫描目录配置
	conf->SetPath("/dirs");
	//读取默认参数
	def_dir_cfg.sub = conf->ReadLong("sub",0);
	def_dir_cfg.include = conf->Read("include");
	def_dir_cfg.exclude = conf->Read("exclude");

	wxArrayString paths;
	for(bool test = conf->GetFirstGroup(cmds,index); test ; conf->SetPath("../"),test = conf->GetNextGroup(cmds,index))
	{
		wxArrayString files;
		conf->SetPath(cmds);
		paths = wxSplit(conf->Read("path"),'|');
		if (paths.empty())
			continue;
		for(int i=paths.size()-1;i>=0;--i)
			ListFiles(paths[i],&files, conf->Read("include",def_dir_cfg.include) , conf->Read("exclude",def_dir_cfg.exclude) , conf->ReadLong("sub",def_dir_cfg.sub));
		g_commands->AddFiles(files);
	}
	conf->SetPath("/Config");
}
Beispiel #13
0
bool CResourceManager::RemoveDirectory(const std::string& directory)
{
    if (PHYSFS_isInit())
    {
        std::string path = CleanPath(directory);
        for (auto file : ListFiles(path))
        {
            if (PHYSFS_delete((path + "/" + file).c_str()) == 0)
                return false;
        }
        return PHYSFS_delete(path.c_str()) != 0;
    }
    return false;
}
void SkydriveService::FetchUserInfoFinished(QNetworkReply* reply) {
  reply->deleteLater();
  QJson::Parser parser;
  QVariantMap response = parser.parse(reply).toMap();

  QString name = response["name"].toString();
  if (!name.isEmpty()) {
    QSettings s;
    s.beginGroup(kSettingsGroup);
    s.setValue("name", name);
  }

  emit Connected();

  ListFiles("me/skydrive");
}
Beispiel #15
0
void Test9()
{
	//GrowStringList t;
	//t.add("Red"); t.add("Green"); t.add("Blue"); t.add("Yellow");
	//for(int i = 0; i < t.len; i++)
	//	printf("Color %i: %s\n", i, t.get(i));

	LoadBCP("data.bcp");
	GrowStringList *t = ListFiles("Warrior Kings Game Set\\Sounds\\narration"); //""); //"Interface\\Icons\\Special Icons\\");
	for(int i = 0; i < t->len; i++)
		printf("%04i: %s\n", i, t->getdp(i));

	int x = ListDlgBox(t);
	if(x != -1)
		printf("Selected: %i (%s)\n", x, t->getdp(x));

	delete t;
}
Beispiel #16
0
void VerifySimulations(char *assertionFile)
{
	double ** values;
	char **	header;
	char file[LineSize] = "\0";
	char line[LineSize] = "\0";
	FILE *assertFile = NULL;
	FILE *simFiles = NULL;
	int i;
	int numberOfAssertions;
	
	FILE *generalLogFile = NULL;
	int totalAssertions = 0;
	int totalRight = 0;
	int totalWrong = 0;
	int perFileRight = 0;
	int perFileWrong = 0;
	
	remove(GeneralAssertsLog);
	remove(FaultsLog);
	ListFiles();
	
	numberOfAssertions = GetNumberOfAssertions(assertionFile);
	
	FILE *temporaryAssertionsLogs[numberOfAssertions];
	AssertionValues assertions[numberOfAssertions];
	
	for (i = 0; i < numberOfAssertions; i++)
	{
		assertions[i] = (AssertionValues)
		{
			.assertion = { "\0" },
			.nodeName = { "\0" },
			.xMinVal = 0.0,
			.xMaxVal = 0.0,
			.xIsRange = 0,
			.yMinVal = 0.0,
			.yMaxVal = 0.0,
			.yIsRange = 0
		};
	}
Beispiel #17
0
void InterpretCommand(MenuInstanceData * pMenuData, const char *pszScript) {
  char szCmd[31], szParam1[51], szParam2[51];
  char szTempScript[ 255 ];
  memset(szTempScript, 0, sizeof(szTempScript));
  strncpy(szTempScript, pszScript, 250);

  if (pszScript[0] == 0) {
    return;
  }

  char* pszScriptPointer = szTempScript;
  while (pszScriptPointer && !hangup) {
    pszScriptPointer = MenuParseLine(pszScriptPointer, szCmd, szParam1, szParam2);

    if (szCmd[0] == 0) {    // || !pszScriptPointer || !*pszScriptPointer
      break;
    }

    // -------------------------
    // Run a new menu instance

    int nCmdID = GetMenuIndex(szCmd);
    switch (nCmdID) {
    case 0: {
      // "MENU"
      // Spawn a new menu
      MenuInstanceData *pNewMenuData = static_cast<MenuInstanceData *>(malloc(sizeof(MenuInstanceData)));

      memset(pNewMenuData, 0, sizeof(MenuInstanceData));
      pNewMenuData->nFinished = 0;
      pNewMenuData->nReload = 0;

      Menus(pNewMenuData, pMenuData->szPath, szParam1);
      free(pNewMenuData);
    }
    break;
    case 1: {
      // -------------------------
      // Exit out of this instance
      // of the menu
      // -------------------------
      // "ReturnFromMenu"
      InterpretCommand(pMenuData, pMenuData->header.szExitScript);
      pMenuData->nFinished = 1;
    }
    break;
    case 2: {
      // "EditMenuSet"
      EditMenus();           // flag if we are editing this menu
      pMenuData->nFinished = 1;
      pMenuData->nReload = 1;
    }
    break;
    case 3: {
      // "DLFreeFile"
      align(szParam2);
      MenuDownload(szParam1, szParam2, true, true);
    }
    break;
    case 4: {
      // "DLFile"
      align(szParam2);
      MenuDownload(szParam1, szParam2, false, true);
    }
    break;
    case 5: {
      // "RunDoor"
      MenuRunDoorName(szParam1, false);
    }
    break;
    case 6: {
      // "RunDoorFree"
      MenuRunDoorName(szParam1, true);
    }
    break;
    case 7: {
      // "RunDoorNumber"
      int nTemp = atoi(szParam1);
      MenuRunDoorNumber(nTemp, false);
    }
    break;
    case 8: {
      // "RunDoorNumberFree"
      int nTemp = atoi(szParam1);
      MenuRunDoorNumber(nTemp, true);
    }
    break;
    case 9: {
      // "PrintFile"
      printfile(szParam1, true);
    }
    break;
    case 10: {
      // "PrintFileNA"
      printfile(szParam1, false);
    }
    break;
    case 11: {
      // "SetSubNumber"
      SetSubNumber(szParam1);
    }
    break;
    case 12: {
      // "SetDirNumber"
      SetDirNumber(szParam1);
    }
    break;
    case 13: {
      // "SetMsgConf"
      SetMsgConf(szParam1[0]);
    }
    break;
    case 14: {
      // "SetDirConf"
      SetDirConf(szParam1[0]);
    }
    break;
    case 15: {
      // "EnableConf"
      EnableConf();
    }
    break;
    case 16: {
      // "DisableConf"
      DisableConf();
    }
    break;
    case 17: {
      // "Pause"
      pausescr();
    }
    break;
    case 18: {
      // "ConfigUserMenuSet"
      ConfigUserMenuSet();
      pMenuData->nFinished = 1;
      pMenuData->nReload = 1;
    }
    break;
    case 19: {
      // "DisplayHelp"
      if (GetSession()->GetCurrentUser()->IsExpert()) {
        AMDisplayHelp(pMenuData);
      }
    }
    break;
    case 20: {
      // "SelectSub"
      ChangeSubNumber();
    }
    break;
    case 21: {
      // "SelectDir"
      ChangeDirNumber();
    }
    break;
    case 22: {
      // "SubList"
      SubList();
    }
    break;
    case 23: {
      // "UpSubConf"
      UpSubConf();
    }
    break;
    case 24: {
      // "DownSubConf"
      DownSubConf();
    }
    break;
    case 25: {
      // "UpSub"
      UpSub();
    }
    break;
    case 26: {
      // "DownSub"
      DownSub();
    }
    break;
    case 27: {
      // "ValidateUser"
      ValidateUser();
    }
    break;
    case 28: {
      // "Doors"
      Chains();
    }
    break;
    case 29: {
      // "TimeBank"
      TimeBank();
    }
    break;
    case 30: {
      // "AutoMessage"
      AutoMessage();
    }
    break;
    case 31: {
      // "BBSList"
      BBSList();
    }
    break;
    case 32: {
      // "RequestChat"
      RequestChat();
    }
    break;
    case 33: {
      // "Defaults"
      Defaults(pMenuData);
    }
    break;
    case 34: {
      // "SendEMail"
      SendEMail();
    }
    break;
    case 35: {
      // "Feedback"
      FeedBack();
    }
    break;
    case 36: {
      // "Bulletins"
      Bulletins();
    }
    break;
    case 37: {
      // "HopSub"
      HopSub();
    }
    break;
    case 38: {
      // "SystemInfo"
      SystemInfo();
    }
    break;
    case 39: {
      // "JumpSubConf"
      JumpSubConf();
    }
    break;
    case 40: {
      // "KillEMail"
      KillEMail();
    }
    break;
    case 41: {
      // "LastCallers"
      LastCallers();
    }
    break;
    case 42: {
      // "ReadEMail"
      ReadEMail();
    }
    break;
    case 43: {
      // "NewMessageScan"
      NewMessageScan();
    }
    break;
    case 44: {
      // "Goodbye"
      GoodBye();
    }
    break;
    case 45: {
      // "PostMessage"
      WWIV_PostMessage();
    }
    break;
    case 46: {
      // "NewMsgScanCurSub"
      ScanSub();
    }
    break;
    case 47: {
      // "RemovePost"
      RemovePost();
    }
    break;
    case 48: {
      // "TitleScan"
      TitleScan();
    }
    break;
    case 49: {
      // "ListUsers"
      ListUsers();
    }
    break;
    case 50: {
      // "Vote"
      Vote();
    }
    break;
    case 51: {
      // "ToggleExpert"
      ToggleExpert();
    }
    break;
    case 52: {
      // "YourInfo"
      YourInfo();
    }
    break;
    case 53: {
      // "ExpressScan"
      ExpressScan();
    }
    break;
    case 54: {
      // "WWIVVer"
      WWIVVersion();
    }
    break;
    case 55: {
      // "InstanceEdit"
      InstanceEdit();
    }
    break;
    case 56: {
      // "ConferenceEdit"
      JumpEdit();
    }
    break;
    case 57: {
      // "SubEdit"
      BoardEdit();
    }
    break;
    case 58: {
      // "ChainEdit"
      ChainEdit();
    }
    break;
    case 59: {
      // "ToggleAvailable"
      ToggleChat();
    }
    break;
    case 60: {
      // "ChangeUser"
      ChangeUser();
    }
    break;
    case 61: {
      // "CLOUT"
      CallOut();
    }
    break;
    case 62: {
      // "Debug"
      Debug();
    }
    break;
    case 63: {
      // "DirEdit"
      DirEdit();
    }
    break;
    case 65: {
      // "Edit"
      EditText();
    }
    break;
    case 66: {
      // "BulletinEdit"
      EditBulletins();
    }
    break;
    case 67: {
      // "LoadText"
      // LoadText and LoadTextFile are the same, so they are now merged.
      LoadTextFile();
    }
    break;
    case 68: {
      // "ReadAllMail"
      ReadAllMail();
    }
    break;
    case 69: {
      // "Reboot"
      RebootComputer();
    }
    break;
    case 70: {
      // "ReloadMenus"
      ReloadMenus();
    }
    break;
    case 71: {
      // "ResetUserIndex"
      ResetFiles();
    }
    break;
    case 72: {
      // "ResetQScan"
      ResetQscan();
    }
    break;
    case 73: {
      // "MemStat"
      MemoryStatus();
    }
    break;
    case 74: {
      // "PackMsgs"
      PackMessages();
    }
    break;
    case 75: {
      // "VoteEdit"
      InitVotes();
    }
    break;
    case 76: {
      // "Log"
      ReadLog();
    }
    break;
    case 77: {
      // "NetLog"
      ReadNetLog();
    }
    break;
    case 78: {
      // "Pending"
      PrintPending();
    }
    break;
    case 79: {
      // "Status"
      PrintStatus();
    }
    break;
    case 80: {
      // "TextEdit"
      TextEdit();
    }
    break;
    case 81: {
      // "UserEdit"
      UserEdit();
    }
    break;
    case 82: {
      // "VotePrint"
      VotePrint();
    }
    break;
    case 83: {
      // "YLog"
      YesturdaysLog();
    }
    break;
    case 84: {
      // "ZLog"
      ZLog();
    }
    break;
    case 85: {
      // "ViewNetDataLog"
      ViewNetDataLog();
    }
    break;
    case 86: {
      // "UploadPost"
      UploadPost();
    }
    break;
    case 87: {
      // "ClearScreen"
      GetSession()->bout.ClearScreen();
    }
    break;
    case 88: {
      // "NetListing"
      NetListing();
    }
    break;
    case 89: {
      // "WHO"
      WhoIsOnline();
    }
    break;
    case 90: {
      // /A "NewMsgsAllConfs"
      NewMsgsAllConfs();
    }
    break;
    case 91: {
      // /E "MultiEMail"
      MultiEmail();
    }
    break;
    case 92: {
      // "NewMsgScanFromHere"
      NewMsgScanFromHere();
    }
    break;
    case 93: {
      // "ValidatePosts"
      ValidateScan();
    }
    break;
    case 94: {
      // "ChatRoom"
      ChatRoom();
    }
    break;
    case 95: {
      // "DownloadPosts"
      DownloadPosts();
    }
    break;
    case 96: {
      // "DownloadFileList"
      DownloadFileList();
    }
    break;
    case 97: {
      // "ClearQScan"
      ClearQScan();
    }
    break;
    case 98: {
      // "FastGoodBye"
      FastGoodBye();
    }
    break;
    case 99: {
      // "NewFilesAllConfs"
      NewFilesAllConfs();
    }
    break;
    case 100: {
      // "ReadIDZ"
      ReadIDZ();
    }
    break;
    case 101: {
      // "UploadAllDirs"
      UploadAllDirs();
    }
    break;
    case 102: {
      // "UploadCurDir"
      UploadCurDir();
    }
    break;
    case 103: {
      // "RenameFiles"
      RenameFiles();
    }
    break;
    case 104: {
      // "MoveFiles"
      MoveFiles();
    }
    break;
    case 105: {
      // "SortDirs"
      SortDirs();
    }
    break;
    case 106: {
      // "ReverseSortDirs"
      ReverseSort();
    }
    break;
    case 107: {
      // "AllowEdit"
      AllowEdit();
    }
    break;
    case 109: {
      // "UploadFilesBBS"
      UploadFilesBBS();
    }
    break;
    case 110: {
      // "DirList"
      DirList();
    }
    break;
    case 111: {
      // "UpDirConf"
      UpDirConf();
    }
    break;
    case 112: {
      // "UpDir"
      UpDir();
    }
    break;
    case 113: {
      // "DownDirConf"
      DownDirConf();
    }
    break;
    case 114: {
      // "DownDir"
      DownDir();
    }
    break;
    case 115: {
      // "ListUsersDL"
      ListUsersDL();
    }
    break;
    case 116: {
      // "PrintDSZLog"
      PrintDSZLog();
    }
    break;
    case 117: {
      // "PrintDevices"
      PrintDevices();
    }
    break;
    case 118: {
      // "ViewArchive"
      ViewArchive();
    }
    break;
    case 119: {
      // "BatchMenu"
      BatchMenu();
    }
    break;
    case 120: {
      // "Download"
      Download();
    }
    break;
    case 121: {
      // "TempExtract"
      TempExtract();
    }
    break;
    case 122: {
      // "FindDescription"
      FindDescription();
    }
    break;
    case 123: {
      // "ArchiveMenu"
      TemporaryStuff();
    }
    break;
    case 124: {
      // "HopDir"
      HopDir();
    }
    break;
    case 125: {
      // "JumpDirConf"
      JumpDirConf();
    }
    break;
    case 126: {
      // "ListFiles"
      ListFiles();
    }
    break;
    case 127: {
      // "NewFileScan"
      NewFileScan();
    }
    break;
    case 128: {
      // "SetNewFileScanDate"
      SetNewFileScanDate();
    }
    break;
    case 129: {
      // "RemoveFiles"
      RemoveFiles();
    }
    break;
    case 130: {
      // "SearchAllFiles"
      SearchAllFiles();
    }
    break;
    case 131: {
      // "XferDefaults"
      XferDefaults();
    }
    break;
    case 132: {
      // "Upload"
      Upload();
    }
    break;
    case 133: {
      // "YourInfoDL"
      YourInfoDL();
    }
    break;
    case 134: {
      // "UploadToSysop"
      UploadToSysop();
    }
    break;
    case 135: {
      // "ReadAutoMessage"
      ReadAutoMessage();
    }
    break;
    case 136: {
      // "SetNewScanMsg"
      SetNewScanMsg();
    }
    break;
    case 137: {
      // "ReadMessages"
      ReadMessages();
    }
    break;
    /*
    case 138:
    { // "RUN"
    ExecuteBasic(szParam1);
    } break;
    */
    case 139: {
      // "EventEdit"
      EventEdit();
    }
    break;
    case 140: {
      // "LoadTextFile"
      LoadTextFile();
    }
    break;
    case 141: {
      // "GuestApply"
      GuestApply();
    }
    break;
    case 142: {
      // "ConfigFileList"
      ConfigFileList();
    }
    break;
    case 143: {
      // "ListAllColors"
      ListAllColors();
    }
    break;
#ifdef QUESTIONS
    case 144: {
      // "EditQuestions"
      EditQuestions();
    }
    break;
    case 145: {
      // "Questions"
      Questions();
    }
    break;
#endif
    case 146: {
      // "RemoveNotThere"
      RemoveNotThere();
    }
    break;
    case 147: {
      // "AttachFile"
      AttachFile();
    }
    break;
    case 148: {
      // "InternetEmail"
      InternetEmail();
    }
    break;
    case 149: {
      // "UnQScan"
      UnQScan();
    }
    break;
    // ppMenuStringsIndex[150] thru ppMenuStringsIndex[153] not used.....
    case 154: {
      // "Packers"
      Packers();
    }
    break;
    case 155: {
      // Color_Config
      color_config();
    }
    break;
    //------------------------------------------------------------------
    //  ppMenuStringsIndex[156] and [157] are reserved for SDS Systems and systems
    //  that distribute modifications.  DO NOT reuse these strings for
    //  other menu options.
    //------------------------------------------------------------------
    //    case 156:
    //    { // ModAccess
    //        ModsAccess();
    //    } break;
    //    case 157:
    //    { // SDSAccess
    //        SDSAccess();
    //      } break;
    //------------------------------------------------------------------
    case 158: {
      // InitVotes
      InitVotes();
    }
    break;
    case 161: {
      // TurnMCIOn
      TurnMCIOn();
    }
    break;
    case 162: {
      // TurnMCIOff
      TurnMCIOff();
    }
    break;
    default: {
      MenuSysopLog("The following command was not recognized");
      MenuSysopLog(szCmd);
    }
    break;
    }
  }
}
Beispiel #18
0
int kmain(UInt32 initial_stack, MultibootHeader* mboot, UInt32 mboot_magic) {
	initial_esp = initial_stack;
	
	CLI_Init();
	Cls();
	
	UInt32 initrd_end = *(UInt32*)(mboot->mods_addr+4);
	
	placement_address = (Pointer) initrd_end;
	
	// Set up our new stack here.
	//UInt32 stack = (UInt32) kmalloc_a(8192, TRUE);
	MultibootHeader* mboot_hdr = mboot; //kmalloc(sizeof(MultibootHeader));
	//memcpy(mboot_hdr, mboot, sizeof(MultibootHeader));
	
	kprintf("Starting init...\n");

	//new_start(stack, mboot_hdr);
	GDT_Init();
	IDT_Init();
	ISR_Init();
	asm volatile("sti");
	
	kprintf("Basics\t\t\t[OK]\n");

	PIT_Init(PIT_MSTIME);

	kprintf("PIT\t\t\t[OK]\n");

	init_kheap();
	InitPaging((mboot_hdr->mem_lower+mboot_hdr->mem_upper)&~3);
	InitKernelHeap();

	kprintf("Heap\t\t\t[OK]\n");

	VFS_Init();
	DevFS_Init();
	
	kprintf("VFS\t\t\t[OK]\n");

	DriversInit();

	kprintf("Drivers\t\t\t[OK]\n");

	Screen_Init();

	FloppyInit();

	checkAllBuses();
	DumpPCIDeviceData();
	kprintf("PCI\t\t\t[OK]\n");

	/*kprintf("Keyboard Init... ");
	KB_Init(0);
	kprintf("[ok]\n");*/

	FAT12_Init(FAT12_GetContext(FloppyGetDevice()), "/", "sys");
	
	InitTasking();

	KernelSymbolsLoad();

	//Cls();

	kprintf("kOS v0.6.13\n");

	VFS_Node* rd = GetNodeFromFile(GetFileFromPath("/sys"));
	kprintf("rd = %x\n", rd);
	
	ArrayList* list = ListFiles(rd);
	ALIterator* itr = ALGetItr(list);

	while(ALItrHasNext(itr)) {
		VFS_Node* node = ALItrNext(itr);
		kprintf("file: %s\n", node->name);
	}

	ALFreeItr(itr);
	
	ALFreeList(list);

	//kprintf("kprintf symbol = %x\n", getKernelSymbol("kprintf"));
	File* initScript = GetFileFromPath("/sys/init.script");
	FileSeek(0, initScript); // Due to these being global objects, we have to do such ugly things as this.

	#ifdef INIT_DEBUG
	kprintf("initScript=%x\n", initScript);
	#endif

	char* lineBuf = kalloc(256);
	int doBreak = 0;
	while(!doBreak) {
		if(fgetline(initScript, lineBuf, 256, '\n')==-1) {
			if(strlen(lineBuf) > 0) {
				doBreak = 1;
			} else {
				break; // We've processed everything that needs to be processed.
			}
		}

		// Now parse it.
		char* tok = strtok(lineBuf, " ");
		kprintf("%s, %x\n", tok,tok);
		if(!strcmp(tok, "load_driver")) {
			#ifdef INIT_DEBUG
			kprintf("load_driver ");
			#endif

			tok = strtok(NULL, " ");

			// Load the driver specified.
			File* drv = GetFileFromPath(tok);
			if(drv != NULL) {
				int drvLength = FileSeek(SEEK_EOF, drv);
				FileSeek(0, drv);
				void* drvBuf = kalloc(drvLength);

				#ifdef INIT_DEBUG
				kprintf("%s\n", GetNodeFromFile(drv)->name);
				#endif

				ReadFile(drvBuf, drvLength, drv);
				ELF* elf = LoadKernelDriver(drvBuf);

				#ifdef INIT_DEBUG
				kprintf("elf->start=%x\n", elf->start);
				#endif

				if(elf->error == 0) {
					void (*driverInit)() = (void (*)()) elf->start;
					driverInit();
				}

				kfree(drvBuf);
				drvBuf = NULL;

				CloseFile(drv);
			}
		}
	}

	CloseFile(initScript);
	kfree(lineBuf);

	kprintf("Kernel init done...\n");

	File* elf = GetFileFromPath("/sys/helloworld");
	
	FileSeek(SEEK_EOF, elf);
	int length = FileTell(elf);
	FileSeek(0, elf);
	UInt8* elfBuf = kalloc(length);
	ReadFile(elfBuf, length, elf);
	ELF* elfExe = Parse_ELF(elfBuf);
	CreateTaskFromELF(elfExe);

	// Kernel main logic loop
	while(1) {
		asm volatile("hlt");
	}

	return 0;
}
Beispiel #19
0
//InitMenuSettings
bool Menu::InitMenuSettings ()
{
    Err fErr (m_Err, L"InitMenuSettings");

    wstring sMenuSettings, sFullscreen, sVerticalSync, sFramelimit, sOk,
            sLanguage, sResolution, sColorDepth, sMouseSensitivity,
            sAntialiasing, sAccept, sHelp;
    bool bFullscreen, bVerticalSync, bHelp;
    int nFramelimit, nMouseSensitivity, nAntialiasing;
    if (!m_pLanguage->Get (L"SettingsTitle", &sMenuSettings) ||
        !m_pLanguage->Get (L"SettingsResolution", &sResolution) ||
        !m_pLanguage->Get (L"SettingsColorDepth", &sColorDepth) ||
        !m_pLanguage->Get (L"SettingsFullscreen", &sFullscreen) ||
        !m_pLanguage->Get (L"SettingsAntialiasing", &sAntialiasing) ||
        !m_pLanguage->Get (L"SettingsVerticalSync", &sVerticalSync) ||
        !m_pLanguage->Get (L"SettingsFrameLimit", &sFramelimit) ||
        !m_pLanguage->Get (L"SettingsLanguage", &sLanguage) ||
        !m_pLanguage->Get (L"SettingsHelp", &sHelp) ||
        !m_pLanguage->Get (L"SettingsMouseSensitivity", &sMouseSensitivity) ||
        !m_pLanguage->Get (L"SettingsOk", &sOk) ||
        !m_pLanguage->Get (L"SettingsAccept", &sAccept) ||
        !m_pConfig->GetBool (sCONF_FULLSCREEN, &bFullscreen) ||
        !m_pConfig->GetBool (s_sVerticalSync, &bVerticalSync) ||
        !m_pConfig->GetBool (sCONF_HELP, &bHelp) ||
        !m_pConfig->GetNum (s_sFramelimit, &nFramelimit) ||
        !m_pConfig->GetNum (s_sMouseSensitivity, &nMouseSensitivity) ||
        !m_pConfig->GetNum (s_sAntialiasing, &nAntialiasing))
    {
        return false;
    }

    std::vector<wstring> lsLanguages;
    if (!ListFiles (m_sLanguageDir, &lsLanguages))
    {
        return fErr.Set (L"Could not list the language files");
    }
    unsigned int nLanguageId = 0;
    for (; nLanguageId != lsLanguages.size (); nLanguageId++)
    {
        if (lsLanguages.at (nLanguageId) == m_pLanguage->GetFileName ())
        {
            break;
        }
    }

    std::vector<wstring> lsResolutions, lsDepths;
    unsigned int nOldColorDepth = 0, nCurResId = 0,
                 nCurDepthId = 0, nCurDepth = 0;
    bool bNextDepth = false;
    wstring sCurResolution;
    if (!m_pConfig->Get (s_sResolution, &sCurResolution) ||
        !m_pConfig->GetNum (s_sColorDepth, &nCurDepth))
    {
        return false;
    }
    for (unsigned int i = 0; i != sf::VideoMode::GetModesCount (); i++)
    {
        sf::VideoMode Mode = sf::VideoMode::GetMode (i);

        if (Mode.BitsPerPixel != nOldColorDepth)
        {
            if (nOldColorDepth != 0)
            {
                bNextDepth = true;
            }
            nOldColorDepth = Mode.BitsPerPixel;
            if (nCurDepth == nOldColorDepth)
            {
                nCurDepthId = lsDepths.size ();
            }
            lsDepths.push_back (NumToStr (nOldColorDepth));
        }
        //Because all resolutions are mutliply saved for every color depth
        if (bNextDepth)
        {
            continue;
        }

        wstring sEntry (NumToStr (Mode.Width) + s_sResDelim +
                        NumToStr (Mode.Height));
        if (sEntry == sCurResolution)
        {
            nCurResId = lsResolutions.size ();
        }
        lsResolutions.push_back (sEntry);
    }

    if (!m_ScreenSettings.Init (&m_Err, m_pProfiles, m_pWindow,
                                sMenuSettings) ||
        !m_ScreenSettings.AddList (sResolution, Vector2f (50, 150),
                                   lsResolutions, nCurResId,
                                   eSettingsListResolution) ||
        !m_ScreenSettings.AddList (sColorDepth, Vector2f (500, 150), lsDepths,
                                   nCurDepthId, eSettingsListColorDepth) ||
        !m_ScreenSettings.AddCheckbox (sFullscreen, Vector2f (50, 250),
                                       eSettingsCheckFullscreen, bFullscreen) ||
        !m_ScreenSettings.AddEditbox (sAntialiasing, Vector2f (500, 250), 50,
                                      eSettingsEditAntialiasing,
                                      NumToStr (nAntialiasing)) ||
        !m_ScreenSettings.AddCheckbox (sVerticalSync, Vector2f (50, 350),
                                       eSettingsCheckVerticalSync,
                                       bVerticalSync) ||
        !m_ScreenSettings.AddEditbox (sFramelimit, Vector2f (600, 350), 100,
                                      eSettingsEditFramelimit,
                                      NumToStr (nFramelimit)) ||
        !m_ScreenSettings.AddList (sLanguage, Vector2f (50, 450),
                                   lsLanguages, nLanguageId,
                                   eSettingsListLanguage) ||
        !m_ScreenSettings.AddCheckbox (sHelp, Vector2f (400, 450),
                                       eSettingsCheckHelp, bHelp) ||
        !m_ScreenSettings.AddEditbox (sMouseSensitivity, Vector2f (50, 550),
                                      150, eSettingsEditMouseSensitivity,
                                      NumToStr (nMouseSensitivity)) ||
        !m_ScreenSettings.AddButton (sOk, Vector2f (300, 650),
                                     eSettingsButtonOk) ||
        !m_ScreenSettings.AddButton (m_sAbort, Vector2f (525, 650),
                                     eSettingsButtonAbort) ||
        !m_ScreenSettings.AddButton (sAccept, Vector2f (750, 650),
                                     eSettingsButtonAccept))
    {
        return false;
    }

    return true;
}//InitMenuSettings
Beispiel #20
0
/*-----------------------------------------------------------------------------
 *  Event Handlers
 *-----------------------------------------------------------------------------*/
void SerialConfigurator::KeyEvtHdl( wxKeyEvent& event )
{
   if (event.GetModifiers() == wxMOD_CONTROL )
   {
      switch (event.GetKeyCode())
      {
         case '/':
            {
               wxString temp;
               //temp.Printf(wxT("%d"), event.GetKeyCode());
               temp.Printf(wxT("Selection: %d\nCount: %d"), m_filesList->GetSelection(), m_filesList->GetCount());
               wxMessageBox( temp, _T("DEBUG"), wxOK);
            }
            break;

         case 'J':
            {
               int selection = m_filesList->GetSelection();
               if (wxNOT_FOUND == selection) selection = -1;

               if (selection < (int) m_filesList->GetCount())
               {
                  selection++;
                  m_filesList->SetSelection(selection);
                  m_Text->SaveFile();
                  m_Text->LoadFile(files[selection]);
               }
            }
            break;

         case 'K':
            {
               int selection = m_filesList->GetSelection();
               if (wxNOT_FOUND == selection) selection = m_filesList->GetCount();

               if (selection > 0)
               {
                  selection--;
                  m_filesList->SetSelection(selection);
                  m_Text->SaveFile();
                  m_Text->LoadFile(files[selection]);
               }
            }
            break;

         case 'O':
            {
               wxDirDialog tmpDialog(this, wxT("Select a folder"), wxFileName::FileName(files[0]).GetPath());

               if ( wxID_OK == tmpDialog.ShowModal())
               {
                  m_workingDirPicker->SetPath(tmpDialog.GetPath());
                  ListFiles();
               }
            }
            break;

         case 'I':
            m_Text->SetFocus();
            break;

         default:
            event.Skip();
            break;
      }
   }
   else
   {
      switch (event.GetKeyCode())
      {
         case WXK_ESCAPE:
            this->Close(false);
            break;
         default:
            event.Skip();
            break;
      }
   }
}
Beispiel #21
0
void SerialConfigurator::ListFilesEvtHdl( wxFileDirPickerEvent& event )
{
   ListFiles();
   event.Skip(); 
}
Beispiel #22
0
void T29_UpdateFiles()
{
	if(t29curfiles) delete t29curfiles;
	t29curfiles = ListFiles(t29curdir, 0);
}
Beispiel #23
0
	void CheckDependencies(const po::variables_map& variables, int& retcode)
	{
		namespace fs = boost::filesystem;

		retcode = 1;

		auto inputs = variables["input"].as<std::vector<std::wstring>>();
		bool verbose = variables["verbose"].as<bool>();
		bool json = variables["json"].as<bool>();
		bool batchDlls = variables["batch-dlls"].as<bool>();
		auto peExtensions = variables["pe-extensions"].as<std::wstring>();
		bool useSystemPath = variables["use-system-path"].as<bool>();

		if (inputs.size() == 0)
		{
			std::wcerr << L"Need input.";
			return;
		}

		auto out = OpenOutput<char>(variables);
		if (!out) 
			return;

		if (useSystemPath)
			LoadSystemPath();

		retcode = 0;

		PrintedSet pathCache;

		if (!batchDlls)
		{
			PEBinaryMap cache;
			auto pe = CollectDependencies(inputs[0], cache);

			if (pe && !pe->resolved)
				retcode = 2;

			if (json)
				*out << PrintDependencyTreeJson(pe, cache, !verbose);
			else
				PrintDependencyTree(*out, pe, pathCache, !verbose);
		}
		else
		{
			std::vector<std::wstring> extensions;
			if (!peExtensions.empty())
				boost::split(extensions, boost::algorithm::to_lower_copy(peExtensions), boost::is_any_of(L";"));
			auto isNonExecutablePE = [&extensions](const boost::filesystem::path& path)
			{
				auto ext = path.extension().wstring();
				boost::algorithm::to_lower(ext);
				boost::algorithm::trim_left_if(ext, boost::is_any_of(L"."));
				if (ext == L"exe")
					return false;

				return extensions.size() == 0 || std::find(extensions.begin(), extensions.end(), ext) != extensions.end();
			};

			// all PE files that are not executables
			std::list<fs::path> files;
			for (auto& input : inputs)
				files.splice(files.end(), ListFiles(input, isNonExecutablePE));

			// process them all over one cache
			PEBinaryMap peCache;
			std::list<PEBinaryPtr> peBinaries;
			for (auto& file : files)
				peBinaries.push_back(CollectDependencies(file, peCache));

			if (json)
				*out << PrintDependencyTreeJson(PEBinaryPtr(), peCache, !verbose);

			for (auto& pe : peBinaries)
			{
				if (!pe)
					continue;

				if (!pe->resolved)
					retcode = 2;

				if (!json)
					PrintDependencyTree(*out, pe, pathCache, !verbose);
			}
		}
	}
static void
PlayerCtrlTask(void *pvParameters){
  //portTickType ulLastTime;
  
  //char itemCount = 0;
  unsigned char soundCtrl = 0;
  //Start Player Ctrl
  usStopPlayerCtrl = 0;
  
  //List files in root
  ListFiles();
  sFilePath=getCurrentFile();
  //DisplayMenu(0x03);
    //
    // Loop forever.
    //
  vTaskSuspendScheduler();
  ShowStartup();
  xTaskResumeScheduler();
  xTaskDelay(5000);
  
  while(1){
    //get event from button
    if( xQueueReceive(xPlayerCtrlQueue, (unsigned char*)&usEventCode,100)==pdPASS)
    {
      //Events from USB
      if(usEventCode == STOP_PLAYER)
      {
        PlayState=PAUSE_STATE;
        usStopPlayerCtrl = 1;//*Stop Player Ctrl
        soundCtrl = STOP;//*Stop Sound Player
        giveSoundCtrlEvent((unsigned char*)&soundCtrl,portMAX_DELAY);
      }
      else if (usEventCode == START_PLAYER)
      {
        usStopPlayerCtrl = 0;//*Start Player Ctrl
        Root = MENU;
        ChooseItem = NOWPLAY;
        DisplayMenu(0x03);
      }
      
      //USB not pluged in
      if(usStopPlayerCtrl == 0)
      {
        //Play sound Button when button pressed
        if(usEventCode < 10 && SoundButton)
        {
          soundCtrl = PLAY_BTN_SND;
          giveSoundCtrlEvent((unsigned char*)&soundCtrl,100);
        }
        //Events from Sound Player
        if(usEventCode==PLAY_DONE)
        {
          /**Play Mode: Normal*/
          //TODO Play next song
          
          if(PlayMode == 0){//normal
            sFilePath = nextFile();
            if(ucFileIndex!=0)
            {
             soundCtrl = START;
             giveSoundCtrlEvent((unsigned char*)&soundCtrl,100);;
            }
          }else if(PlayMode == 1)//Single
          {
            ;
          }else if(PlayMode ==2)//repeate
          {
            soundCtrl = START;
            giveSoundCtrlEvent((unsigned char*)&soundCtrl,100);;
          }else if(PlayMode==3)//loop
          {
            sFilePath = nextFile();
            soundCtrl = START;
            giveSoundCtrlEvent((unsigned char*)&soundCtrl,100);;
          }
          //
          if(ChooseItem == NOWPLAY)
          {
            NowPlay(STATE_UPDATE);
            NowPlay(SELECTED_UPDATE);
          }
        }
        
        //Events form user buttons
        if(Root == ITEM)
        {
          if(ChooseItem == NOWPLAY){
            if(usEventCode == L_CENTER)
            {
              Root = MENU;//*back ROOT
              DisplayMenu(0x03);
            }else if(usEventCode == S_CENTER)
            {
              soundCtrl=PAUSE_PLAY;
              giveSoundCtrlEvent((unsigned char*)&soundCtrl,100);
              NowPlay(STATE_UPDATE);
              
            }else if(usEventCode == S_RIGHT)
            {     
              soundCtrl = VLM_UP;
              giveSoundCtrlEvent((unsigned char*)&soundCtrl,100);
              NowPlay(VOLUME_UPDATE);
            }
            else if(usEventCode == S_LEFT)
            {
              soundCtrl = VLM_DOWN;
              giveSoundCtrlEvent((unsigned char*)&soundCtrl,100);
              NowPlay(VOLUME_UPDATE);
            }
            else if(usEventCode == S_UP)
            {
              //Play next song
              sFilePath = preFile();
              NowPlay(SELECTED_UPDATE);
              
              soundCtrl = START;
              giveSoundCtrlEvent((unsigned char*)&soundCtrl,100);
            }
            else if(usEventCode == S_DOWN)
            {
              //Play previous song
              sFilePath = nextFile();
              NowPlay(SELECTED_UPDATE);
              
              soundCtrl = START;
              giveSoundCtrlEvent((unsigned char*)&soundCtrl,100);
            }
          }
          else if(ChooseItem == BROWSE)
          {
            if(usEventCode == L_CENTER)
            {
                //back ROOT/parent's Dir
              vTaskSuspendScheduler();
              if(BackParentDir())
              {
                Root = MENU;
                DisplayMenu(0x03);
              }
              else
                Browse(BROWSE_UPDATE);
              xTaskResumeScheduler();
            }
            else if(usEventCode == S_CENTER)
            {
               //open dir if it's dir, else file and play;
              vTaskSuspendScheduler();
              ListFiles();
              xTaskResumeScheduler();
              ChooseItem = NOWPLAY;
              NowPlay(0x1f);
            }
            else if(usEventCode == S_UP){
              PreItem();
              Browse(BROWSE_UPDATE);
            }else if(usEventCode == S_DOWN){
              NextItem();
              Browse(BROWSE_UPDATE);
            }else if(usEventCode == L_DOWN || usEventCode == L_UP){
              vTaskSuspendScheduler();
              OpenChooseDir();
              xTaskResumeScheduler();
              Browse(BROWSE_UPDATE);
            }
          }else if(ChooseItem == SETTINGS){
            if(usEventCode == L_CENTER){
                Root = MENU;//*back MENU
                DisplayMenu(0x03);
            }else if(usEventCode == S_CENTER)
            {
              if(Selected == PLAY_MODE)
              {
                PlayMode++;
                if(PlayMode >3)
                  PlayMode =0;
              }else if(Selected == BUTTON_SOUND)
              {
                SoundButton++;
                if(SoundButton>1)
                  SoundButton =0;
              }
              Settings(SETTING_MODE);
            }
            else if(usEventCode == S_UP)
            {
              Selected++;
              if(Selected > 1)
                Selected=0;
              Settings(SETTING_MODE);
            }else if(usEventCode == S_DOWN)
            {
              Selected--;
              if(Selected > 1)
                Selected=1;
              Settings(SETTING_MODE);
            }
          }else if(ChooseItem == INFO){
            if(usEventCode == L_CENTER){
                Root = MENU;//*back MENU
                DisplayMenu(0x03);
            }
          }
        }
        else if(Root == MENU){
          if(usEventCode == S_CENTER){
            Root = ITEM;//enter choose item;
            if(ChooseItem==NOWPLAY)
            {
              NowPlay(0x1f);
            }
            else if(ChooseItem==BROWSE)
            {
              vTaskSuspendScheduler();
              ListDirItems();
              xTaskResumeScheduler();
              Browse(0x3);
            }
            else if(ChooseItem==SETTINGS)
            {
              Settings(0x03);
            }
            else if(ChooseItem==INFO)
            {
              Info(0x03);
            }
          }else if(usEventCode == S_UP){
            ChooseItem--;//previous item
            if(ChooseItem > INFO)
              ChooseItem = INFO;
            DisplayMenu(MENU_SELECT_UPDATE);
          }else if(usEventCode == S_DOWN){
            ChooseItem++;//next item
            if(ChooseItem > INFO)
              ChooseItem = NOWPLAY;
            DisplayMenu(MENU_SELECT_UPDATE);
          } 
        }
      }else{
        //USB mass storage
        USBTransfer();
      }
        
    }
    if(Root == ITEM)
    {
        if(ChooseItem == NOWPLAY){
            //Update time playing
            if(clock)
            {
              NowPlay(TIME_UPDATE);
              clock=0;
            }
        }
     }
  }
}