Main/Clicker.java
// This handles both save and load (Module)
This handles both save and load (Module)
This handles both save and load ( Module )
private void accessFile(String function, String file){
        ReadWriteTextFileJDK7 saveWrite = new ReadWriteTextFileJDK7();
        try{
            if (function.equals("save")){
                List<String> saveData = Arrays.asList(
                  String.valueOf(getCount()),
                  textArea.getText()
                );
                saveWrite.writeSmallTextFile(saveData,"Saves\\"+file+".ClickerGame");
            }else if(function.equals("load")){
                List<String> loadData = saveWrite.readSmallTextFile("Saves\\"+file+".ClickerGame");
                StringBuilder string = new StringBuilder("");
                setCount(Integer.parseInt(loadData.get(0)));
                boolean first = true;
                for(String i: loadData){
                    if(first) {
                        first = false;
                        continue;
                    }
                    string.append(i+"\n");
                }
                textArea.setText(String.valueOf(string));
            }
        }catch(Exception IO){
            System.out.println("Access: "+IO);
        }
    }
private void accessFile ( String function , String file ) { ReadWriteTextFileJDK7 saveWrite = new ReadWriteTextFileJDK7 ( ) ; try { if ( function . equals ( "save" ) ) { List < String > saveData = Arrays . asList ( String . valueOf ( getCount ( ) ) , textArea . getText ( ) ) ; saveWrite . writeSmallTextFile ( saveData , "Saves\\" + file + ".ClickerGame" ) ; } else if ( function . equals ( "load" ) ) { List < String > loadData = saveWrite . readSmallTextFile ( "Saves\\" + file + ".ClickerGame" ) ; StringBuilder string = new StringBuilder ( "" ) ; setCount ( Integer . parseInt ( loadData . get ( 0 ) ) ) ; boolean first = true ; for ( String i : loadData ) { if ( first ) { first = false ; continue ; } string . append ( i + "\n" ) ; } textArea . setText ( String . valueOf ( string ) ) ; } } catch ( Exception IO ) { System . out . println ( "Access: " + IO ) ; } }
This handles both save and load (Module)
This handles both save and load ( Module )
//new String(fc.encrypt(String.valueOf(getCount())),"UTF-8"), //new String(fc.encrypt(textArea.getText()),"UTF-8") //setCount(Integer.parseInt(fc.decrypt( (loadData.get(0)).getBytes("UTF-8") ))); //string.append(fc.decrypt(i.getBytes("UTF-8"))+"\n");