public void patchConfig(File inFile, File outFile) throws IOException {

		TreeSet<String> alreadyemitted = new TreeSet<>();
		String line;
		ConfigLine parse = new ConfigLine();

		BufferedReader reader = new BufferedReader(new FileReader(inFile));
		FileWriter writer = new FileWriter(outFile);
		try {
			for (;;) {
				line = reader.readLine();
				if (line == null) {
					break;		// End of file reached
				}
				if (line.length() != 0) {
					parse.parseUptoKey(line);
					if (parse.key != null) {
						parse.value = keyValue.get(parse.key);		// Check if this is a key we control
					}
					if (parse.value != null) {
						parse.skipValueParseComment(line);		// Discard the original value, but preserve any comment
					}
					if (parse.status > 0) {		// A controlled key
						if (!alreadyemitted.contains(parse.key)) {	// Have not emitted yet
							line = parse.key + " = " + parse.value;
							if (parse.comment.length() != 0) {
								line = line + "          " + parse.comment;
							}
							alreadyemitted.add(parse.key);
						}
						else {			// Have already emitted before
							if (parse.status == 1) {
								line = '#' + line;
							}
						}
					}
				}
				writer.write(line);
				writer.write('\n');
			}

			for (Entry<String, String> entry : keyValue.entrySet()) {
				if (!alreadyemitted.contains(entry.getKey())) {
					line = entry.getKey() + " = " + entry.getValue();
					writer.write(line);
					writer.write('\n');
				}
			}
		}
		finally {
			reader.close();
			writer.close();
		}
	}
Given a set of key/value pairs, established via restoreXml or manually entered via addKey,
read in an existing configuration file, and write out an altered form, where:
  1) Keys matching something in the keyValue map have their value altered to match the map
  2) Keys that don't match anything in the map, are output unaltered
  3) Comments, both entire line and those coming after key/value pairs, are preserved
@param inFile the file to read
@param outFile the new file to write
@throws IOException if the files cannot be read from or written to
Ghidra/Features/BSim/src/main/java/ghidra/features/bsim/query/ServerConfig.java