public static void main(String[] args) throws IOException, ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException {
		Octopart.setApiKey("566cc7d2");
		UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		FileDialog filepicker = new FileDialog((java.awt.Frame) null);
		
		try {
			PartCache.getInstance().loadCache(new File("./mpncache.json"));
		} catch (Exception e) {
			System.out.println("no cache found, creating one");
		}
		
		Runtime.getRuntime().addShutdownHook(new Thread() {
			@Override
			public void run() {
				PropertyManager.getInstance().clear();
				HashMap<String,Object> props = PropertyManager.getInstance().getProperties();
				List<Object> inventories = (List<Object>) props.get("inventories");
				List<Object> projects = (List<Object>) props.get("projects");
				for (Frame frame : JFrame.getFrames()) {
					if (!frame.isVisible()) continue;
					if (frame instanceof MicropartMonster) {
						inventories.add(((MicropartMonster)frame).getWindowState());
					} else if (frame instanceof Project) {
						projects.add(((Project)frame).getWindowState());
					}
				}
				PropertyManager.getInstance().save();
			}
		});
		
		HashMap<String,Object> data = PropertyManager.getInstance().getProperties();
		List<Object> inventories = (List<Object>) data.get("inventories");
		boolean inventoryWindow = false;
		for (Object inv : inventories) {
			MicropartMonster mm = new MicropartMonster();
			try {
				mm.restoreWindowState(inv);
				inventoryWindow = true;
			} catch (FileNotFoundException e) {
				mm.dispose();
			}
		}
		if (!inventoryWindow) {
			System.out.println("none found, creating new..");
			new MicropartMonster();
		}
		
		List<Object> projects = (List<Object>) data.get("projects");
		for (Object proj : projects) {
			new Project().restoreWindowState(proj);
		}
	}