(File file)
| 49 | } |
| 50 | |
| 51 | static public DiskType determineType(File file) { |
| 52 | if (file == null || !file.exists()) return null; |
| 53 | if (file.isDirectory()) return VIRTUAL; |
| 54 | if (file.getName().toLowerCase().endsWith("hdv")) { |
| 55 | return LARGE; |
| 56 | } |
| 57 | if (file.getName().toLowerCase().endsWith("nib")) { |
| 58 | return FLOPPY140_NIB; |
| 59 | } |
| 60 | if (file.getName().toLowerCase().endsWith("dsk")) { |
| 61 | return FLOPPY140_DO; |
| 62 | } |
| 63 | long length = file.length(); |
| 64 | if (length <= 64*1024) return SINGLELOAD; |
| 65 | if (length == FloppyDisk.DISK_2MG_NIB_LENGTH || length == FloppyDisk.DISK_2MG_NON_NIB_LENGTH) |
| 66 | return FLOPPY140_2MG; |
| 67 | if (length == FloppyDisk.DISK_NIBBLE_LENGTH) |
| 68 | return FLOPPY140_NIB; |
| 69 | if (length == FloppyDisk.DISK_PLAIN_LENGTH) { |
| 70 | if (file.getName().toLowerCase().endsWith(".po")) return FLOPPY140_PO; |
| 71 | return FLOPPY140_DO; |
| 72 | } |
| 73 | if (Math.abs( (800 * 1024) - length) <= 1024) { |
| 74 | return FLOPPY800; |
| 75 | } |
| 76 | return LARGE; |
| 77 | } |
| 78 | } |
no test coverage detected