public void loadCategories(File dir){
		this.dir = dir;
		categories.clear();
		dialogs.clear();

		lastUsedCatID = 0;
		lastUsedDialogID = 0;

		for(File file : dir.listFiles()){
			if(!file.isDirectory())
				continue;
			DialogCategory category = loadCategoryDir(file);
			Iterator<Entry<Integer, Dialog>> ite = category.dialogs.entrySet().iterator();
			while(ite.hasNext()){
				Entry<Integer, Dialog> entry = ite.next();
				int id = entry.getKey();
				if(id > lastUsedDialogID)
					lastUsedDialogID = id;
				Dialog dialog = entry.getValue();
				if(dialogs.containsKey(id)){
					System.out.println("Duplicate id " + dialog.id + " from category " + category.getTitle());
					ite.remove();
				}
				else{
					dialogs.put(id, dialog);
				}
			}
			lastUsedCatID++;
			category.setID(lastUsedCatID);
			categories.put(category.getID(), category);
		}
		
	}