Exemple #1
0
bool 
Project::AddFolderByName(wxString folder_name, FolderType type) {
	wxArrayString folders = wxSplit(folder_name, wxFILE_SEP_PATH);
	std::vector<Folder>* folder_vec = this->folders.GetFolders();
	wxString folder_path = wxT("");
	Folder folder(QGF_FOLDER_TYPE_SCRIPT, wxT(""), wxT(""));
	if (folders.Count() == 1) {
		folder_vec->push_back(Folder(type, folders.Last(), folders.Last()));
		return true;
	}
	for (wxArrayString::iterator it = folders.begin() ; it != folders.end(); ++it) {
		wxString new_full_path = (folder_path == wxT("")) ? *it : folder_path + wxFILE_SEP_PATH + *it;
		folder = Folder(QGF_FOLDER_TYPE_OTHER, *it, new_full_path);
		std::vector<Folder>::iterator pos = std::find(folder_vec->begin(), folder_vec->end(), folder);
		if (pos == folder_vec->end()) return false;
		wxString full_path = pos->GetFullPath() + wxFILE_SEP_PATH + folders.Last();
		if (full_path == folder_name) {
			pos->GetSubFolders()->push_back(Folder(type, folders.Last(), full_path));
			return true;
		}

		folder_vec = pos->GetSubFolders();
		folder_path = new_full_path;
	}
	return false;
}
Exemple #2
0
USB_Drive::USB_Drive()
{
	ID = 0;
	beingUsed = false;
	folders.insert(std::pair<string, Folder>("default", Folder()));
	//"default" folder refers to the Drive itself, similar to the concept of a desktop
}
Exemple #3
0
USB_Drive::USB_Drive(int set_space,  string set_model)
{
	space = set_space;
	model = set_model;

	ID = 0;
	beingUsed = false;
	folders.insert(std::pair<string, Folder>("default", Folder()));
	//"default" folder refers to the Drive itself, similar to the concept of a desktop
}
Exemple #4
0
void Folder::scan(){
    DIR* currentDirectory;
    struct dirent* readFile;
    string sPath;
    char *cPath, *temp = NULL;
    size_t cPathSize, tempSize = 512;
    struct stat infosFichier;
    //Bloc de conversion string vers char* pour la compatibilité avec les appels systeme
    sPath = this->getPath();
    cPathSize = sPath.size() + 1;
    cPath = new char[ cPathSize ];
    strncpy(cPath, sPath.c_str(), cPathSize);
    //On ouvre le dossier
    currentDirectory = opendir(cPath);
    if (currentDirectory == NULL){//Si erreur
	perror("Error: ");
    }
    else{
	Folder newFolder;
	File newFile;
        temp = (char*)malloc(tempSize * sizeof(char));
        while((readFile = readdir(currentDirectory)) != NULL){//Parcours des fichiers du répertoire
            //Bloc de création du chemin du fichier parcouru
	    strcpy(temp, cPath);
	    strcat(temp, "/");
            strcat(temp, readFile->d_name);

	    if (! lstat(temp, &infosFichier)){//Récupération des infos du fichiers
                if(strcmp(readFile->d_name, ".") && strcmp(readFile->d_name, "..")){//On évite les dossiers "." et ".."
		    if(S_IFDIR & infosFichier.st_mode){//Si le fichier est un répertoire
			//On crée un nouveau dossier
                        newFolder = Folder(string(readFile->d_name), this->getPath());
			newFolder.scan();//On le scanne (ce qui permet de lister en profondeur les ss dossiers/fichiers)
			newFolder.sort();//Tri du dossier
                        folders.push_back(newFolder);//Ajout du dossier au vecteur
		    }
		    else {//Si ce n'est pas un répertoire
                        newFile = File(string(readFile->d_name), this->getPath());//On crée un nveau fichier
                        files.push_back(newFile);//On l'ajoute au répertoire
		    }
		}
	    }
	}
    }
    //libération de l'espace mémoire

    delete readFile;
    delete[] cPath;
    free(temp);
    closedir(currentDirectory);
}
Exemple #5
0
	bool Folder::Create(bool recursively)const
	{
		if (recursively)
		{
			auto folder = filePath_.GetFolder();
			if (folder.IsFile()) return false;
			if (folder.IsFolder()) return Create(false);
			return Folder(folder).Create(true) && Create(false);
		}
		else
		{
			return CreateDirectory(filePath_.GetFullPath().Buffer(), NULL) != 0;
		}
	}
Exemple #6
0
void PHPFolder::DeleteChildFolder(const wxString& name, const wxString& projectPath, bool notify)
{
    PHPFolder::Ptr_t folder = Folder(name);
    CHECK_PTR_RET(folder);

    wxArrayString files;
    folder->GetFiles(files, projectPath);

    // iter is valid (otherwise, folder would have been NULL)
    PHPFolder::List_t::iterator iter =
        std::find_if(m_children.begin(), m_children.end(), PHPFolder::CompareByName(name));
    m_children.erase(iter);
    
    if(notify) {
        DoNotifyFilesRemoved(files);
    }
}
Exemple #7
0
bool
Project::RemoveFolderByName(wxString folder_name) {
	wxArrayString folders = wxSplit(folder_name, wxFILE_SEP_PATH);
	std::vector<Folder>* folder_vec = this->folders.GetFolders();
	wxString folder_path = wxT("");
	Folder folder(QGF_FOLDER_TYPE_OTHER, wxT(""), wxT(""));
	for (wxArrayString::iterator it = folders.begin() ; it != folders.end(); ++it) {
		wxString new_full_path = (folder_path == wxT("")) ? *it : folder_path + wxFILE_SEP_PATH + *it;
		folder = Folder(QGF_FOLDER_TYPE_OTHER, *it, new_full_path);
		std::vector<Folder>::iterator pos = std::find(folder_vec->begin(), folder_vec->end(), folder);
		if (pos == folder_vec->end()) return false;
		if (pos->GetFullPath() == folder_name) {
			folder_vec->erase(pos);
			return true;
		}
		folder_vec = pos->GetSubFolders();
		folder_path = new_full_path;
	}
	return false;
}
Exemple #8
0
	bool Folder::GetFolders(std::list<Face::Folder>& folders)const
	{
		if (!Exists()) 
			return false;
		WIN32_FIND_DATA findData;
		HANDLE findHandle = INVALID_HANDLE_VALUE;

		while (true)
		{
			if (findHandle == INVALID_HANDLE_VALUE)
			{
				WString searchPath = (filePath_ / L"*").GetFullPath();
				findHandle = FindFirstFile(searchPath.Buffer(), &findData);
				if (findHandle == INVALID_HANDLE_VALUE)
				{
					break;
				}
			}
			else
			{
				BOOL result = FindNextFile(findHandle, &findData);
				if (result == 0)
				{
					FindClose(findHandle);
					break;
				}
			}

			if (findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
			{
				if (wcscmp(findData.cFileName, L".") != 0 && wcscmp(findData.cFileName, L"..") != 0)
				{
					folders.push_back(Folder(filePath_ / findData.cFileName));
				}
			}
		}
		return true;
	}
void SubhaloMatch(unsigned isnap){
  std::string filename = Folder("output") + Snaps(isnap) + "/ahf_out_mtree";
  unsigned dim=GetLineNumber(filename);
  std::cout<<filename << " has " << dim << " lines." << std::endl;
  unsigned hostno[dim], hostpop[dim], sharedpop[dim], subno[dim], subpop[dim];
  GetMtreeFile( filename, dim, &hostno[0], &hostpop[0], &sharedpop[0], &subno[0], &subpop[0] );
  WriteMtree2File( filename, dim, &hostno[0], &hostpop[0], &sharedpop[0], &subno[0], &subpop[0] );
  //for(int line=0; line<dim; ++line)
  //	std::cout<<subno[line]<<std::endl;

  //std::cout<<" * Building hostno <=> sharedpop map...";
  //std::map<unsigned, unsigned> hsmap;
  //for ( unsigned j = 0; j < dim; ++j )
  //	hsmap.insert( std::make_pair ( hostno[ j ], sharedpop[ j ] ) );
  //std::endl<<"done!"<<std::endl;

  // find number of halos
  unsigned count=0;
  for(unsigned sh=0; sh<dim; ++sh)
    if( hostno[sh] == subno[sh] )
      ++count;
  std::cout << " * Found " << count << " different halos." << std::endl;
  int hosts[count];


  unsigned shcount = 0;
  unsigned sucount = 0;
  unsigned hocount = 0;
  // run through all subhalos
  for( unsigned subhalo = 0; subhalo < dim; ++subhalo ){
    if( hostno[subhalo] != subno[subhalo] )
      continue;
    std::cout << " * * Looking at line " << subhalo << std::endl;
    sucount = 0;
    hocount = 0;
    //count how many times it appears in subno
    std::cout << "subhalo = " << hostno[subhalo] << std::endl;
    for(unsigned su=0; su<dim; ++su)
      if( subno[su] == hostno[subhalo] )
	++sucount;
    //count how many times it appears in hostno
    for(unsigned ho=0; ho < dim; ++ho)
      if( hostno[ho] == hostno[subhalo] )
	++hocount;
    // autocorrelation should yield same no. subhalos and host halos
    std::cout << "sucount = " << sucount << ", hocount = " << hocount << std::endl;
    if(sucount!=hocount)
      std::cerr << " * * Found wrong subhalo!" << std::endl;
    if(sucount<2){
      std::cout << " * * Subhalo occurs only once, it has no host." << std::endl;
      hosts[shcount] = -1;
      ++shcount;
      continue;
    }

    std::cout<<" * * Generating array with shared populations...";
    unsigned shpop[sucount][2]; // [][0] takes sharepop, [][1] takes hostno
    unsigned shpopcount=0;
    for( unsigned sc = 0; sc < dim; ++sc){
      if(subno[sc] == hostno[subhalo] && subpop[sc]<hostpop[sc]){ // found occurrence
	shpop[shpopcount][0] = sharedpop[sc];
	shpop[shpopcount][1] = hostno[sc];
	std::cout << shpop[shpopcount][1] << " " << shpop[shpopcount][0] << std::endl;
	++shpopcount;
      }
    }
    std::cout << shpopcount << " constituents, done!" << std::endl;
    if(shpopcount==0){
      hosts[shcount]=-2;
      ++shcount;
      continue;
    }
    std::cout<<" * * Getting maximum of shared populations...";
    unsigned scmax=0;
    for(unsigned sc=0; sc<shpopcount; ++sc){
      if(shpop[sc][0]>shpop[scmax][0])
	scmax=sc;
    }
    std::cout<<scmax<<", done!"<<std::endl;
		
    std::cout<<" * * Getting host corresponding to maximal shared population... ";
    hosts[shcount]=shpop[scmax][1];
    ++shcount;
    std::cout<<hosts[shcount-1]<<", done!"<<std::endl;
  }
  std::cout << shcount << " subhalos matched."<<std::endl;

  writedebug(DEBUG," * Creating _mtree_idx file...");
  std::ofstream fout;
  fout.open ( (filename+"_idx2").c_str(), std::ios_base::out );
  for(unsigned sc=0; sc<shcount; ++sc){
    fout << sc << " "<<hosts[sc] << std::endl;
  }
  fout.close();
  donedebug(DEBUG);
}
Exemple #10
0
	static void normalizeFolderName(QString &Value_) {
		QDir Folder(Value_);
		Value_ = QDir::toNativeSeparators(Folder.absolutePath());
		Q_ASSERT(!Value_.endsWith(QDir::separator()));
		Value_ += QDir::separator();
		}
Exemple #11
0
void
mouseintr(uint tick)
{
	uint ch;
	ch = inb(0x64);
	if((ch & 0x01) == 0)
	{
		//cprintf("no data\n");
		state = 1;
		return;
	}

	acquire(&mouse_lock);
	ch = inb(0x60);

	if(state == 1)
	{
		if((ch & 0x08) == 0 || (ch & 0x04) != 0)
		{
			release(&mouse_lock);
			return;
		}
		left_down = (ch & 0x01) ? 1 : 0;
		right_down = (ch & 0x02) ? 1 : 0;
		x_sign = (ch & 0x10) ? 1 : 0;
		y_sign = (ch & 0x20) ? 1 : 0;
		x_overflow = (ch & 0x40) ? 1 : 0;
		y_overflow = (ch & 0x80) ? 1 : 0;
		state = 2;
		release(&mouse_lock);
		//cprintf("state1\n");
		//cprintf("overflow: %d\n", y_overflow);
		return;
	}
	else if(state == 2)
	{
		int dis;
		if(x_sign == 0)
			dis = ch;
		else
			dis = ch - 256;
		if(dis > 50 || dis < -50)
		{
			//cprintf("error");
			state = 1;
			release(&mouse_lock);
			return;
		}
		//cprintf("xdis: %d, sign: %d\n", dis, x_sign);
		x_position += dis;
		if(x_position < 0)
			x_position = 0;
		if(x_position > SCREEN_WIDTH - SIZE_X_MOUSE)
			x_position = SCREEN_WIDTH - SIZE_X_MOUSE;
		state = 3;
		release(&mouse_lock);
		//cprintf("state2\n");
		return;
	}
	else if(state == 3)
	{
		int dis;
		if(y_sign == 0)
			dis = ch;
		else
			dis = ch - 256;
		if(dis > 50 || dis < -50)
		{
			//cprintf("error");
			state = 1;
			release(&mouse_lock);
			return;
		}
		//cprintf("ydis: %d, sign: %d, overflow: %d\n", dis, y_sign, y_overflow);
		y_position -= dis;
		if(y_position < 0)
			y_position = 0;
		if(y_position > SCREEN_HEIGHT - SIZE_Y_MOUSE)
			y_position = SCREEN_HEIGHT - SIZE_Y_MOUSE;
		state = 1;
		release(&mouse_lock);
		//cprintf("state3\n");
	}
	else
	{
		state = 1;
		release(&mouse_lock);
		return;
	}

	event = 0;

	if(left_already_down == 0 && right_already_down == 0)
	{
		if(left_down == 1)
		{
			left_already_down = 1;
			x_drag_start = x_position;
			y_drag_start = y_position;
		}
		else if(right_down == 1)
		{
			right_already_down = 1;
		}
	}

	else if(left_already_down == 1)
	{
		if(left_down == 0)
		{
			//cprintf("dragging: %d\n", is_dragging);
			if(is_dragging == 1)
			{
				event = DRAG_RELEASE;
				is_dragging = 0;
			}
			else
			{
				int dtick = tick - left_click_tick;
				//cprintf("tick: %d\n", dtick);
				if(dtick > 15)
				{
					event = LEFT_CLICK;
					left_click_tick = tick;
				}
				else
				{
					event = DOUBLE_CLICK;
					left_click_tick = -20;
				}
			}
			left_already_down = 0;
		}
		else
		{
			event = DRAGGING;
			is_dragging = 1;
		}
	}

	else if(right_already_down == 1)
	{
		if(right_down == 0)
		{
			event = RIGHT_CLICK;
			right_already_down = 0;
		}
	}

	if(event == 0)
	{
		draw_mouse(x_position, y_position);
		return;
	}

	struct Window* win;
	int click_icon = -1;
	if(y_position > ICON_Y && y_position < ICON_Y + 75 + 18)
	{
		if(event != LEFT_CLICK)
		{
			draw_mouse(x_position, y_position);
			return;
		}
		if(x_position > ICON_X1 && x_position < ICON_X1 + 75)
		{
			click_icon = ICON_FINDER;
		}
		else if(x_position > ICON_X2 && x_position < ICON_X2 + 75)
		{
			click_icon = ICON_PHOTO;
		}
		else if(x_position > ICON_X3 && x_position < ICON_X3 + 75)
		{
			click_icon = ICON_TEXT;
		}
		else if(x_position > ICON_X4 && x_position < ICON_X4 + 75)
		{
			click_icon = ICON_GAME;
		}
		else if(x_position > ICON_X5 && x_position < ICON_X5 + 75)
		{
			click_icon = ICON_DRAW;
		}
		else if(x_position > ICON_X6 && x_position < ICON_X6 + 75)
		{
			click_icon = ICON_SETTING;
		}
		else
		{
			draw_mouse(x_position, y_position);
			return;
		}

		win = get_window_by_icon(click_icon);
		if(click_icon == ICON_FINDER || win == 0)
		{
			win = Add_Window(click_icon);
			if(win != 0)
				draw_window(win);
		}
		else if(win != 0 && WindowLine->next != win)
		{
			draw_window(win);
			Focus(win);
		}
  		display_to_screen(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
		draw_mouse(x_position, y_position);
		return;
	}

	win = Click_Get_Window(x_position, y_position);
	if(win != 0 && WindowLine->next != win)
	{
		//cprintf("window: %d\n", win->Cur_icon);
		if(event == LEFT_CLICK)
		{
			draw_window(win);
	  		display_to_screen(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
			Focus(win);
		}
	}
	else if(win != 0)
	{
		int Pos_x, Pos_y;
		Pos_x = x_position - win->Pos_x;
		Pos_y = y_position - win->Pos_y;
		if(Pos_x > 2 && Pos_x < 18 && Pos_y > 2 && Pos_y < 18)
		{
			Close_Window();
			draw_again(get_current_bg());
		}
		else if(Pos_y < 20)
		{
			if(event == DRAGGING)
			{
				if(dragging_top_window == 0)
				{
					dragging_top_window = 1;
					x_drag_window = win->Pos_x;
					y_drag_window = win->Pos_y;
					dragging_count = 0;
				}
				dragging_count = (dragging_count + 1) % 5;
				if(dragging_count != 0)
					return;
				if(x_drag_window + (x_position - x_drag_start) < 0 || 
					x_drag_window + (x_position - x_drag_start) + WindowWidth > SCREEN_WIDTH ||
					y_drag_window + (y_position - y_drag_start) < 0 ||
					y_drag_window + (y_position - y_drag_start) + WindowHeight > SCREEN_HEIGHT)
					return;
				draw_bottom(get_current_bg());
				win->Pos_x = x_drag_window + (x_position - x_drag_start);
				win->Pos_y = y_drag_window + (y_position - y_drag_start);
				draw_window(win);
				display_to_screen(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
			}
			else if(event == DRAG_RELEASE)
			{
				if(dragging_top_window == 1)
					dragging_top_window = 0;
			}
		}
		else if(Pos_y > 20 && Pos_y < WindowHeight - 20)
		{
			switch(win->Cur_icon)
			{
				case ICON_DRAW:
					draw(win, Pos_x, Pos_y, event);
					break;
				case ICON_SETTING:
					setting(Pos_x, Pos_y, event);
					break;
				case ICON_FINDER:
					Folder(win, Pos_x, Pos_y, event);
					break;
				case ICON_GAME:
					pointInGameWindow(Pos_x, Pos_y, event);
					break;
				case 8://LIST_FINDER
					Folder(win, Pos_x, Pos_y, event);
					break;
				case 9://LAYOUT_FINDER
					Folder(win, Pos_x, Pos_y, event);
					break;
			}
		}
	}

	draw_mouse(x_position, y_position);


}
Exemple #12
0
Browser::Browser()
{	
	string input, destination, newpath;
	path = "/";
	vector<string> params;
	
	// pass buffer
	manager.setBuffer(&buffer);
	
	string command;
	pwd = Folder(0, 0, "root");

	// WELCOME
	//printw("%s", "## Welcome in Rapidshare Manager \n");
	//printw("%s", "rs#~/ ");
	
	//refresh();
	//move(linenum,6);
	//cout << "## Welcome in Rapidshare Manager" << endl;
	//cout << "rs#~/ ";
	
	while(true) {
		
		input = buffer.getCommand();
		//getline(cin, input);
		//printw("---- %s -----", input.c_str());
		trim(input);
		split(params, input, is_any_of(" "));

		command = params[0];
	
		if(command == "ls"){
			manager.listFolder(pwd);
		}
		if(command == "help"){
			showHelp();
		}
		if(command == "mv"){
			
			params = processParams(input, command, 2);
			
			mv(getCurrentPath(params[0]), getCurrentPath(params[1]));
			
		}
		if(command == "cd"){
			
			params = processParams(input, "cd", 1);
					
			if(params[0] == ".."){
				if(!pwd.isRoot()){
					pwd = manager.getFolder(pwd.parent);
					path = pwd.path;
				}else{
					path = "/";
				}
					
			}else{		
				
				if(pwd.isRoot()){
					path = pwd.path + params[0];
				}else{
					path = pwd.path + "/" + params[0];
				}
				
				if(manager.getFolder(path).notFound()) {
					cout << "not found" << endl;
				}else{
					pwd = manager.getFolder(path);
				}			
			}
			
		}
		if(command == "cp"){	
			
			params = processParams(input, "cp", 2);		
			if(params.size() == 2){
				bool local = isLocal(params[0]);
				string destination;
				
				if(local){
					destination = getCurrentPath(params[1]);
					path = params[0];
					
				}else{				
					path = getCurrentPath(params[0]);
					destination = params[1];
				
				}
				copy(path, destination, local);				
			}
			
		}
		if(command == "pwd"){
			cout << pwd.path << endl;
		}
		if(command == "play"){
			
			
			params = processParams(input, command, 1);	
			/*if(params.size() == 1){
				
				bool isNumber = true;
				// jedna se o cislo?
				for(int i = 0; i < (int)params.size();i++){
					if(!isdigit(params[0][i])){
						isNumber = false;
					}
				}
				
				if(isNumber){
					play(pwd.path, lexical_cast<int>(params[0]));
				}else{
					play(getCurrentPath(params[0]));
				}
				
			}else{
				cout << "Wrond number of params" << endl;
			}*/

			
			
			
		}
		if(command == "clear"){
			system("clear");
		}
		if(command == "mkdir")
		{
			params = processParams(input, command, 1);
			mkdir(pwd.path, params[0]);
		}
		if(command == "rename"){
			
			params = processParams(input, "rename", 2);
			path = getCurrentPath(params[0]);
			rename(path, params[1]);
		}
		if(command == "rm")
		{
			
			params = processParams(input, command, 1);
			path = getCurrentPath(params[0]);
			rm(path);
			
		}
		if(command == "exit"){
			
			// ukoncime ncurses
			endwin();
			exit(1);
		}
		
		//cout  << "rs#~" << pwd.path << " ";
		buffer.changeStart("rs#~" + pwd.path + " ");
		buffer.writeStart();
		
	};
	
	cout << endl;
}
Exemple #13
0
int CModelListHelper::BuildList(LPCTSTR SectName, char* pGroup, CComboBox* pCB, CTreeCtrl *pTree, CProfINIFile *pPF)
  {
  LPCTSTR InitialSelect = pPF?pPF->RdStr(SectName, "$LastInsert", (char*)DefaultLastUnit):"?";
  if (!InitialSelect)
    InitialSelect ="";

  DWORD LicCat = gs_License.LicCatagories();
  Strng Desc;
  RequestModelInfoRec MInfo;
  HTREEITEM hSelected=NULL, hFirst=NULL;

  CString Sect(SectName);
  Sect+=".Tree";

  int nValidModels = 0;
  int nModels = 0;
  while (gs_pPrj->RequestModelInfoByGroupIndex(pGroup, nModels, MInfo))
    {
    const bool ModelGroupOK = ((LicCat & TOC_MDL_MASK & MInfo.Category)!=0);
    const bool SolveModeOK = ((LicCat & TOC_SOLVE_MASK & MInfo.Category)!=0);
    if (MInfo.IsSelectable && ModelGroupOK && SolveModeOK)
      {
      char* pSlctText = MInfo.ShortDesc() ? MInfo.ShortDesc() : MInfo.Class();
      if (pCB)
        pCB->AddString(pSlctText);
      Desc.Set("%s:%s", pSlctText, (MInfo.Desc() ? MInfo.Desc() : "No Description Available"));
      m_ModelDescLst.Append(Desc());
      m_ModelBaseTagLst.Append(MInfo.TagInitialID());
      m_ModelClassLst.Append(MInfo.Class());
      m_ModelDrwGroupLst.Append(MInfo.DrwGroup());

      if (0)
        {
        // temporary code to Restructure FlwSymbols 
        for (int Pass=0; Pass<4; Pass++)
          {
          Strng Path;
          Path.Set("%s%s.*.%s", Pass<2?BaseGrfSymbolFiles():GrfSymbolFiles(), MInfo.TagInitialID(), Pass%2==0?"DXF":"BMP");
          WIN32_FIND_DATA fd;
          HANDLE H = FindFirstFile(Path(), &fd);
          bool AllDone = (H==INVALID_HANDLE_VALUE);
          while (!AllDone)
            {
            Strng Folder, Src, Dst;
            Folder.Set("%s%s", BaseGrfSymbolFiles(), MInfo.DrwGroup());
            Src.Set("%s%s", BaseGrfSymbolFiles(), fd.cFileName);
            Dst.Set("%s%s\\%s", BaseGrfSymbolFiles(), MInfo.DrwGroup(), &fd.cFileName[MInfo.TagInitialID.Length()+1]);
            dbgpln("MOVE %-60s >> %s", Src(), Dst());

            Strng E;
            if (FnCreatePath(Folder(), E))
              {
              Move_FileEx(Src(), Dst(), MOVEFILE_REPLACE_EXISTING|MOVEFILE_WRITE_THROUGH);
              }

            AllDone = !FindNextFile(H, &fd);
            }
          FindClose(H);
          }
        }

      if (pTree)
        {
        HTREEITEM hParent = TVI_ROOT, hItem;
        char Buff[2048];
        char *pS=Buff, *pE;
        strcpy(Buff, pSlctText);
        while ((pE=strchr(pS, ':'))!=NULL)
          {
          *pE=0;
          XStrTrim(pS, " ");
          for (hItem=pTree->GetNextItem(hParent, TVGN_CHILD);
               hItem!=NULL; 
               hItem=pTree->GetNextItem(hItem, TVGN_NEXT))
            {
            CString S=pTree->GetItemText(hItem);
            if (S.CompareNoCase(pS)==0)
              break;
            }
          if (hItem==NULL)
            {
            XStrTrim(pS, " ");
            hItem=pTree->InsertItem(pS, 0, 0, hParent);
            pTree->SortChildren(hParent);
            pTree->SetItemData(hItem, 0xFFFF);
            pTree->SetItemImage(hItem, 0, 1);
            }
          hParent=hItem;
          pS=pE+1;
          }

        XStrTrim(pS, " ");
        hItem=pTree->InsertItem(pS, 0, 0, hParent);
        if (_stricmp(MInfo.Class(), InitialSelect)==0)
          hSelected=hItem;
        if (hFirst==NULL)
          hFirst=hItem;
        pTree->SetItemData(hItem, nValidModels);
        pTree->SortChildren(hParent);
        pTree->SetItemImage(hItem, 2, 3);

        if (pPF)
          {
          // Restore State of Tree
          HTREEITEM hParent = TVI_ROOT, hItem;
          CString Txt[10];
          long iDepth=0;
          hItem=pTree->GetNextItem(TVI_ROOT, TVGN_CHILD);
          while (hItem && iDepth>=0)
            {
            UINT State=pTree->GetItemState(hItem, TVIS_EXPANDED );
            if (1)
              {
              CString S;
              for (int i=0; i<iDepth; i++)
                S+=Txt[i];
              S+=pTree->GetItemText(hItem);        
              UINT State=(UINT)pPF->RdInt(Sect, S, 0);
              if (State&TVIS_EXPANDED)
                {
                pTree->Expand(hItem, TVE_EXPAND);        
                //??????????
                }
              }
            
            HTREEITEM h=pTree->GetNextItem(hItem, TVGN_CHILD);
            if (h)
              {
              Txt[iDepth]=pTree->GetItemText(hItem);        
              Txt[iDepth]+=":";        
              iDepth++;
              hItem=h;
              }
            else
              {
              h=pTree->GetNextItem(hItem, TVGN_NEXT);
              if (h)
                {
                hItem=h;
                }
              else
                {
                // Go One up & One along 
                hItem=pTree->GetNextItem(hItem, TVGN_PARENT);
                if (hItem)
                  hItem=pTree->GetNextItem(hItem, TVGN_NEXT);
                iDepth--;
                }
              }
            }
          }
        }
      nValidModels++;
      }
    nModels++;
    }
  if (pTree)
    {
    if (!hSelected)
      hSelected=hFirst;
    pTree->Select(hSelected, TVGN_CARET);
    //pTree->SelectSetFirstVisible(hSelected);
    }
  return nValidModels;
  }