We are developing a simple ArcGIS Runtime file explorer application. For this kind of scenario it would be very helpful if the API is offering some "fail safe" method determining whether or not a file is a valid map/tile/locator- package. Right now, we are just doin a plain string comparison using the file extension (see below). It would be really nice to have the same functionality like IMapDocument.isMapDocument(String) from ArcObjects e.g. PackageUtils.isMapPackage(File), PackageUtils.isTilePackage(File), PackageUtils.isLocatorPackage(File). The method shown below is called by the label provider of the tree viewer whenever a node should be populated. The "fail safe" method should be fast, otherwise the UI could become unresponsive. File explorer application:[ATTACH=CONFIG]13357[/ATTACH] /** * Determines whether or not the specified element represents a map package. * * @param element * the element to validate * @return <code>true</code> only when this element represents a map package and has the type of {@link File}. */ public static boolean isMapPackage(Object element) { if (element instanceof File) { return ((File) element).getName().endsWith(".mpk"); } return false; }
Is there any method providing this kind of "fail safe" access to packages?Thanks in advance.
Product Manager
Developers and Location Services
Germany and Switzerland