@@ -94,18 +94,20 @@ public static void setLastMessage(String lastMessage) {
9494 printProgress ();
9595 }
9696
97- private static void collectionInterface () {
97+ private static boolean collectionInterface () {
9898 if (backtestingFolder .exists () && backtestingFolder .isDirectory ()) {
9999 String [] backtestingFiles = getDataFiles ();
100100 if (backtestingFiles .length == 0 ) {
101101 System .out .println ("---No backtesting files detected" );
102- return ;
102+ return true ;
103103 }
104104
105105 String input = "" ;
106106 while (!input .equalsIgnoreCase ("new" )) {
107107 if (input .equalsIgnoreCase ("quit" )) {
108108 System .exit (0 );
109+ } else if (input .equalsIgnoreCase ("modes" )) {
110+ return false ;
109111 }
110112 if (input .matches ("\\ d+" )) {
111113 int index = Integer .parseInt (input );
@@ -118,12 +120,14 @@ private static void collectionInterface() {
118120 System .out .println ("[" + (i + 1 ) + "] " + backtestingFiles [i ]);
119121 }
120122 System .out .println ("\n Enter \" new\" to start collecting a new data file" );
121- System .out .println ("Enter \" quit\" to exit the program\n " );
123+ System .out .println ("Enter \" quit\" to exit the program" );
124+ System .out .println ("Enter \" modes\" to return to mode selection.\n " );
122125 input = sc .nextLine ();
123126 }
124127 } else {
125128 System .out .println ("---No backtesting files detected" );
126129 }
130+ return true ;
127131 }
128132
129133 public static String [] getDataFiles () {
@@ -162,21 +166,28 @@ public static void startCollection() {
162166
163167 System .out .println ("\n ---Collection completed, result in "
164168 + new File (filename ).getAbsolutePath ());
165- System .out .println ("---Files may only appear after quitting" );
166169
167170 describe (filename );
168171 } catch (Exception e ) {
169172 e .printStackTrace ();
170173 System .out .println ("---Recovery failed, removing temp files" );
171174 deleteTemp ();
175+ try {
176+ Files .deleteIfExists (Path .of (filename ));
177+ } catch (IOException ioException ) {
178+ ioException .printStackTrace ();
179+ }
172180 }
173181 }
174182 }
175183 } else {
176184 deleteTemp ();
177185 }
178186 }
179- collectionInterface ();
187+ boolean returnToModes = collectionInterface ();
188+ if (!returnToModes ) {
189+ return ;
190+ }
180191 System .out .println ("Enter collectable currency (BTC, LINK, ETH...)" );
181192 while (true ) {
182193 try {
@@ -261,6 +272,8 @@ public void run() {
261272 }
262273 }
263274 }, requestDelay , requestDelay );
275+
276+ Collection .setLastMessage ("Sending requests..." );
264277 int id = 0 ;
265278 while (true ) {
266279 long diff = end - start ;
@@ -294,7 +307,6 @@ public void run() {
294307 System .out .println ("\n ---Collection completed in "
295308 + Formatter .formatDuration (System .currentTimeMillis () - initTime ) + ", result in "
296309 + new File (filename ).getAbsolutePath ());
297- System .out .println ("---Files may only appear after quitting" );
298310
299311 describe (filename );
300312
0 commit comments