- /**
- * Return an {@link URL} from this {@link String}, be it a file path or an
- * actual {@link URL}.
- *
- * @param sourceString
- * the source
- *
- * @return the corresponding {@link URL}
- *
- * @throws MalformedURLException
- * if this is neither a file nor a conventional {@link URL}
- */
- private static URL getUrl(String sourceString) throws MalformedURLException {
- if (sourceString == null || sourceString.isEmpty()) {
- throw new MalformedURLException("Empty url");
+ if (exitCode != 255) {
+ switch (action) {
+ case IMPORT:
+ exitCode = imprt(urlString, pg);
+ updates.ok(); // we consider it read
+ break;
+ case EXPORT:
+ exitCode = export(luid, typeString, target, pg);
+ updates.ok(); // we consider it read
+ break;
+ case CONVERT:
+ exitCode = convert(urlString, typeString, target,
+ plusInfo == null ? false : plusInfo, pg);
+ updates.ok(); // we consider it read
+ break;
+ case LIST:
+ exitCode = list(typeString);
+ break;
+ case READ:
+ exitCode = read(luid, chapString, true);
+ break;
+ case READ_URL:
+ exitCode = read(urlString, chapString, false);
+ break;
+ case HELP:
+ syntax(true);
+ exitCode = 0;
+ break;
+ case SET_READER:
+ break;
+ case VERSION:
+ System.out
+ .println(String.format("Fanfix version %s"
+ + "\nhttps://github.com/nikiroo/fanfix/"
+ + "\n\tWritten by Nikiroo",
+ Version.getCurrentVersion()));
+ updates.ok(); // we consider it read
+ break;
+ case START:
+ UIUtils.setLookAndFeel();
+ BasicReader.setDefaultReaderType(ReaderType.LOCAL);
+ BasicReader.getReader().start(null);
+ break;
+ }