Java Code Examples for ghidra.framework.model.DomainFolder#getFolders()

The following examples show how to use ghidra.framework.model.DomainFolder#getFolders() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DeleteProjectFilesTask.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private void deleteFolder(DomainFolder folder, TaskMonitor monitor) throws CancelledException {

		for (DomainFolder subFolder : folder.getFolders()) {
			monitor.checkCanceled();
			if (!selectedFolders.contains(subFolder)) {
				deleteFolder(subFolder, monitor);
			}
		}

		for (DomainFile file : folder.getFiles()) {
			monitor.checkCanceled();
			if (!selectedFiles.contains(file)) {
				deleteFile(file);
				monitor.incrementProgress(1);
			}
		}

		deleteEmptyFolder(folder);
	}
 
Example 2
Source File: ProjectDataDeleteTask.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private void preprocessFolder(DomainFolder folder, TaskMonitor monitor)
		throws CancelledException {
	if (foldersToDelete.containsKey(folder)) {
		return;
	}

	monitor.setMessage("Checking " + folder.getPathname());
	foldersToDelete.put(folder, null);
	for (DomainFile file : folder.getFiles()) {
		monitor.checkCanceled();
		preprocessFile(file, monitor);
		monitor.incrementProgress(1);
	}

	for (DomainFolder subFolder : folder.getFolders()) {
		monitor.checkCanceled();
		preprocessFolder(subFolder, monitor);
	}
}
 
Example 3
Source File: IngestTask.java    From ghidra with Apache License 2.0 6 votes vote down vote up
/**
 * Recursively finds all domain objects that are program files under a domain folder.
 * @param programs the "return" value; found programs are placed in this collection
 * @param myFolder the domain folder to search
 * @param monitor a task monitor
 * @throws CancelledException if the user cancels
 */
protected void findPrograms(ArrayList<DomainFile> programs, DomainFolder myFolder,
		TaskMonitor monitor) throws CancelledException {
	if (myFolder == null) {
		return;
	}
	DomainFile[] files = myFolder.getFiles();
	for (DomainFile domainFile : files) {
		monitor.checkCanceled();
		monitor.incrementProgress(1);
		if (domainFile.getContentType().equals(ProgramContentHandler.PROGRAM_CONTENT_TYPE)) {
			programs.add(domainFile);
		}
	}
	DomainFolder[] folders = myFolder.getFolders();
	for (DomainFolder domainFolder : folders) {
		monitor.checkCanceled();
		monitor.incrementProgress(1);
		findPrograms(programs, domainFolder, monitor);
	}
}
 
Example 4
Source File: FindErrors.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private void findPrograms(ArrayList<DomainFile> programs, DomainFolder folder)
		throws VersionException, CancelledException, IOException {
	DomainFile[] files = folder.getFiles();
	for (DomainFile domainFile : files) {
		if (monitor.isCancelled()) {
			return;
		}
		if (domainFile.getContentType().equals(ProgramContentHandler.PROGRAM_CONTENT_TYPE)) {
			programs.add(domainFile);
		}
	}
	DomainFolder[] folders = folder.getFolders();
	for (DomainFolder domainFolder : folders) {
		if (monitor.isCancelled()) {
			return;
		}
		findPrograms(programs, domainFolder);
	}
}
 
Example 5
Source File: CollectFailedRelocations.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private void findPrograms(ArrayList<DomainFile> programs, DomainFolder folder)
		throws VersionException, CancelledException, IOException {
	DomainFile[] files = folder.getFiles();
	for (DomainFile domainFile : files) {
		if (monitor.isCancelled()) {
			return;
		}
		if (domainFile.getContentType().equals(ProgramContentHandler.PROGRAM_CONTENT_TYPE)) {
			programs.add(domainFile);
		}
	}
	DomainFolder[] folders = folder.getFolders();
	for (DomainFolder domainFolder : folders) {
		if (monitor.isCancelled()) {
			return;
		}
		findPrograms(programs, domainFolder);
	}
}
 
Example 6
Source File: FindNamedFunction.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private void findPrograms(ArrayList<DomainFile> programs, DomainFolder folder)
		throws VersionException, CancelledException, IOException {
	DomainFile[] files = folder.getFiles();
	for (DomainFile domainFile : files) {
		if (monitor.isCancelled()) {
			return;
		}
		if (domainFile.getContentType().equals(ProgramContentHandler.PROGRAM_CONTENT_TYPE)) {
			programs.add(domainFile);
		}
	}
	DomainFolder[] folders = folder.getFolders();
	for (DomainFolder domainFolder : folders) {
		if (monitor.isCancelled()) {
			return;
		}
		findPrograms(programs, domainFolder);
	}
}
 
Example 7
Source File: FindFunctionByHash.java    From ghidra with Apache License 2.0 6 votes vote down vote up
private void findPrograms(ArrayList<DomainFile> programs, DomainFolder folder)
		throws VersionException, CancelledException, IOException {
	DomainFile[] files = folder.getFiles();
	for (DomainFile domainFile : files) {
		if (monitor.isCancelled()) {
			return;
		}
		if (domainFile.getContentType().equals(ProgramContentHandler.PROGRAM_CONTENT_TYPE)) {
			programs.add(domainFile);
		}
	}
	DomainFolder[] folders = folder.getFolders();
	for (DomainFolder domainFolder : folders) {
		if (monitor.isCancelled()) {
			return;
		}
		findPrograms(programs, domainFolder);
	}
}
 
Example 8
Source File: CountDomainFilesTask.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void countFiles(DomainFolder folder, TaskMonitor monitor) throws CancelledException {
	for (DomainFile domainFile : folder.getFiles()) {
		if (!files.contains(domainFile)) {
			fileCount++;
		}
	}

	for (DomainFolder subFolder : folder.getFolders()) {
		monitor.checkCanceled();
		if (!folders.contains(subFolder)) {
			countFiles(subFolder, monitor);
		}
	}
}
 
Example 9
Source File: FidStatistics.java    From ghidra with Apache License 2.0 5 votes vote down vote up
private void findDomainFiles(LinkedList<DomainFile> programs, DomainFolder folder)
		throws VersionException, CancelledException, IOException {
	DomainFile[] files = folder.getFiles();
	for (DomainFile domainFile : files) {
		monitor.checkCanceled();
		if (domainFile.getContentType().equals(ProgramContentHandler.PROGRAM_CONTENT_TYPE)) {
			programs.add(domainFile);
		}
	}
	DomainFolder[] folders = folder.getFolders();
	for (DomainFolder domainFolder : folders) {
		monitor.checkCanceled();
		findDomainFiles(programs, domainFolder);
	}
}