@ -1,6 +1,8 @@
import java.nio.charset.Charset ;
import java.nio.file.Files ;
import java.nio.file.Files ;
import java.nio.file.Path ;
import java.nio.file.Path ;
import java.nio.file.Paths ;
import java.nio.file.Paths ;
import java.nio.file.StandardOpenOption ;
import java.util.ArrayList ;
import java.util.ArrayList ;
import java.util.HashMap ;
import java.util.HashMap ;
import java.util.List ;
import java.util.List ;
@ -185,7 +187,7 @@ public class ArcadeReader {
ArcadeReader . err ( new Exception ( "Test \"" + filename + "\" Failed:\nExpected:" + compare + "\nActual:" + r ) ) ;
ArcadeReader . err ( new Exception ( "Test \"" + filename + "\" Failed:\nExpected:" + compare + "\nActual:" + r ) ) ;
return ;
return ;
}
}
if ( gamePath ( r ) = = null ) {
if ( gamePath ( r . getClass ( ) . getSimpleName ( ) ) = = null ) {
ArcadeReader . err ( new Exception ( "Test \"" + filename + "\" Failed:\nReason: gamePath for this reader type (" + r . getClass ( ) . getSimpleName ( ) + ") does not exist. Check the gamePath() function!" ) ) ;
ArcadeReader . err ( new Exception ( "Test \"" + filename + "\" Failed:\nReason: gamePath for this reader type (" + r . getClass ( ) . getSimpleName ( ) + ") does not exist. Check the gamePath() function!" ) ) ;
return ;
return ;
}
}
@ -665,8 +667,8 @@ public class ArcadeReader {
21 /*maxcombo*/ ,
21 /*maxcombo*/ ,
"{\"ex\":457,\"chip_scritical\":13,\"chip_critical\":15,\"chip_near\":31,\"chip_error\":201,\"long_scritical\":44,\"long_error\":241,\"vol_scritical\":91,\"vol_error\":272,\"failed\":true}" /*other*/ ) ;
"{\"ex\":457,\"chip_scritical\":13,\"chip_critical\":15,\"chip_near\":31,\"chip_error\":201,\"long_scritical\":44,\"long_error\":241,\"vol_scritical\":91,\"vol_error\":272,\"failed\":true}" /*other*/ ) ;
}
}
public static Path gamePath ( Reader data ) {
public static Path gamePath ( String str ) {
switch ( data . getClass ( ) . getSimpleName ( ) ) {
switch ( str ) {
case "DDRReader" : {
case "DDRReader" : {
return Paths . get ( "database" , "ddr" ) ;
return Paths . get ( "database" , "ddr" ) ;
}
}
@ -720,7 +722,7 @@ public class ArcadeReader {
try {
try {
img = ImageIO . read ( p . toFile ( ) ) ;
img = ImageIO . read ( p . toFile ( ) ) ;
Reader newImg = interpret ( img ) ;
Reader newImg = interpret ( img ) ;
Path getGamePath = gamePath ( newImg ) ;
//Path getGamePath = gamePath(newImg);
newImg . interpretBoxes ( p ) ;
newImg . interpretBoxes ( p ) ;
HashMap < String , HashMap < String , List < String > > > DATA = sigPlace . SONG_DATABASE ;
HashMap < String , HashMap < String , List < String > > > DATA = sigPlace . SONG_DATABASE ;
List < String > RECENT_PLAYS = sigPlace . RECENT_PLAYS ;
List < String > RECENT_PLAYS = sigPlace . RECENT_PLAYS ;
@ -760,6 +762,34 @@ public class ArcadeReader {
DATA . put ( newImg . getClass ( ) . getSimpleName ( ) , SONG_DATA ) ;
DATA . put ( newImg . getClass ( ) . getSimpleName ( ) , SONG_DATA ) ;
System . out . println ( DATA ) ;
System . out . println ( DATA ) ;
new Thread ( ) {
public void run ( ) {
//Threaded database update.
for ( String reader : sigPlace . SONG_DATABASE . keySet ( ) ) {
Path dataPath = gamePath ( reader ) ;
for ( String song : sigPlace . SONG_DATABASE . get ( reader ) . keySet ( ) ) {
List < String > data = sigPlace . SONG_DATABASE . get ( reader ) . get ( song ) ;
try {
Files . write ( dataPath . resolve ( song ) , data , Charset . defaultCharset ( ) , StandardOpenOption . CREATE , StandardOpenOption . TRUNCATE_EXISTING , StandardOpenOption . WRITE ) ;
} catch ( IOException e ) {
e . printStackTrace ( ) ;
}
}
}
List < String > data = sigPlace . RECENT_PLAYS ;
try {
Files . write ( Paths . get ( "database" , "recentplays" ) , data , Charset . defaultCharset ( ) , StandardOpenOption . CREATE , StandardOpenOption . TRUNCATE_EXISTING , StandardOpenOption . WRITE ) ;
} catch ( IOException e ) {
e . printStackTrace ( ) ;
}
data = sigPlace . RECENT_RECORDS ;
try {
Files . write ( Paths . get ( "database" , "recentrecords" ) , data , Charset . defaultCharset ( ) , StandardOpenOption . CREATE , StandardOpenOption . TRUNCATE_EXISTING , StandardOpenOption . WRITE ) ;
} catch ( IOException e ) {
e . printStackTrace ( ) ;
}
}
} . start ( ) ;
} catch ( IOException e ) {
} catch ( IOException e ) {
e . printStackTrace ( ) ;
e . printStackTrace ( ) ;
}
}