public Entity loadEntity(File f, String entityName) { Entity entity = null; try { entity = new MechFileParser(f, entityName).getEntity(); } catch (megamek.common.loaders.EntityLoadingException e) { System.out.println("Exception: " + e.toString()); } return entity; }
System.out .println("Note: If you are using the MtfConvert utility, you may also drag and drop files onto it for conversion."); MechFileParser.getResponse("Press <enter> to exit..."); return; BufferedWriter out = null; try { MechFileParser mfp = new MechFileParser(file); Entity e = mfp.getEntity(); if (e instanceof Mech) { outFilename += ".mtf"; if (outFile.exists()) { if (!MechFileParser .getResponse("File already exists, overwrite? ")) { return; MechFileParser.getResponse("Press <enter> to exit..."); } finally { if (out != null) {
public MechFileParser(InputStream is, String fileName) throws EntityLoadingException { try { parse(is, fileName); } catch (Exception ex) { ex.printStackTrace(); if (ex instanceof EntityLoadingException) { throw new EntityLoadingException(ex.getMessage()); } throw new EntityLoadingException("Exception from " + ex.getClass() + ": " + ex.getMessage()); } }
MechFileParser.dispose();
MechFileParser.postLoadInit(m_entity);
case PHASE_DEPLOYMENT: MechFileParser.dispose();
public Entity loadEntity(File f, String entityName) { Entity entity = null; try { entity = new MechFileParser(f, entityName).getEntity(); } catch (megamek.common.loaders.EntityLoadingException e) { System.out.println("Exception: " + e.toString()); //$NON-NLS-1$ } return entity; }
public Entity loadEntity(File f, String entityName) { Entity entity = null; try { entity = new MechFileParser(f, entityName).getEntity(); } catch (megamek.common.loaders.EntityLoadingException e) { System.out.println("Exception: " + e.toString()); //$NON-NLS-1$ } return entity; }
public static Entity loadEntity(File f, String entityName) { Entity entity = null; try { entity = new MechFileParser(f, entityName).getEntity(); } catch (megamek.common.loaders.EntityLoadingException e) { System.out.println("Exception: " + e.toString()); e.printStackTrace(); } return entity; }
/** * Loads the Entity and counts the number of docking hardpoints. * * @param ms The unit to load * @return The number of docking hardpoints on the unit. */ private int countHardpoints(MechSummary ms) { try { Entity entity = new MechFileParser(ms.getSourceFile(), ms.getEntryName()).getEntity(); int hardpoints = entity.getDockingCollars().size(); // TODO: count dropshuttle bays hardpointCache.put(ms, hardpoints); return hardpoints; } catch (EntityLoadingException ex) { return 0; } }
/** * Loads the entity, counts the unit type transport capacity, and adds to the cache. * * @param ms The unit to load * @return true if the Entity can be loaded and counted, false if there was an EntityLoadingException */ private boolean countBays(MechSummary ms) { try { Entity entity = new MechFileParser(ms.getSourceFile(), ms.getEntryName()).getEntity(); bayTypeCache.put(ms, countBays(entity)); return true; } catch (EntityLoadingException ex) { return false; } }
public static void main(String[] ARGS) throws Exception { MechSummary ms = MechSummaryCache.getInstance().getMech(ARGS[0]); Entity e = new MechFileParser(ms.getSourceFile(), ms.getEntryName()) .getEntity(); System.out.println(format(e)); } }
throw(new EntityLoadingException()); Entity e = new MechFileParser(summary.getSourceFile(), summary.getEntryName()).getEntity(); if(null == e) { continue;
MechFileParser mfp = new MechFileParser( zFile.getInputStream(zEntry), zEntry.getName()); Entity e = mfp.getEntity(); MechSummary ms = getSummary(e, fZipFile, zEntry.getName()); vMechs.addElement(ms);
public static Entity getBrandNewUndamagedEntity(String entityShortName) { MechSummary mechSummary = MechSummaryCache.getInstance().getMech( entityShortName); if (mechSummary == null) { return null; } MechFileParser mechFileParser = null; try { mechFileParser = new MechFileParser(mechSummary.getSourceFile()); } catch (EntityLoadingException ex) { MekHQ.getLogger().error(Campaign.class, "getBrandNewUndamagedEntity(String)", ex); } if (mechFileParser == null) { return null; } return mechFileParser.getEntity(); }
.getAllMechs(); for (MechSummary unit : units) { Entity entity = new MechFileParser( unit.getSourceFile(), unit.getEntryName()) .getEntity();
.getAllMechs(); for (MechSummary unit : units) { Entity entity = new MechFileParser( unit.getSourceFile(), unit.getEntryName()) .getEntity();
mechFileParser = new MechFileParser(ms.getSourceFile()); } catch (EntityLoadingException ex) { MekHQ.getLogger().error(Campaign.class, "writeCustoms(PrintWriter)", ex); continue; Entity en = mechFileParser.getEntity(); pw1.println("\t<custom>"); pw1.println("\t\t<name>" + name + "</name>");
public SkinEditorMainGUI() { super(new BorderLayout()); this.addComponentListener(this); panMain.setLayout(cardsMain); panSecondary.setLayout(cardsSecondary); JPanel panDisplay = new JPanel(new BorderLayout()); panDisplay.add(panMain, BorderLayout.CENTER); panDisplay.add(panSecondary, BorderLayout.SOUTH); add(panDisplay, BorderLayout.CENTER); UnitLoadingDialog unitLoadingDialog = new UnitLoadingDialog(frame); if (!MechSummaryCache.getInstance().isInitialized()) { unitLoadingDialog.setVisible(true); } try { MechSummary ms = MechSummaryCache.getInstance().getMech( "Archer ARC-2W"); testEntity = new MechFileParser(ms.getSourceFile(), ms.getEntryName()).getEntity(); } catch (EntityLoadingException e) { e.printStackTrace(); } }