+ break;
+ case HELP:
+ exitCode = 255;
+ break;
+ case SET_READER:
+ exitCode = setReaderType(args[i]);
+ break;
+ case START:
+ exitCode = 255; // not supposed to be selected by user
+ break;
+ }
+ }
+
+ final Progress mainProgress = new Progress(0, 80);
+ mainProgress.addProgressListener(new Progress.ProgressListener() {
+ private int current = mainProgress.getMin();
+
+ public void progress(Progress progress, String name) {
+ int diff = progress.getProgress() - current;
+ current += diff;
+
+ StringBuilder builder = new StringBuilder();
+ for (int i = 0; i < diff; i++) {
+ builder.append('.');
+ }
+
+ System.err.print(builder.toString());
+
+ if (progress.isDone()) {
+ System.err.println("");
+ }
+ }
+ });
+ Progress pg = new Progress();
+ mainProgress.addProgress(pg, mainProgress.getMax());
+
+ if (exitCode != 255) {
+ switch (action) {
+ case IMPORT:
+ exitCode = imprt(urlString, pg);
+ break;
+ case EXPORT:
+ exitCode = export(luid, typeString, target, pg);
+ break;
+ case CONVERT:
+ exitCode = convert(urlString, typeString, target,
+ plusInfo == null ? false : plusInfo, pg);
+ 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 START:
+ UIUtils.setLookAndFeel();
+ BasicReader.setDefaultReaderType(ReaderType.LOCAL);
+ BasicReader.getReader().start(null);
+ break;