diff --git a/builds/HentaiGameManager.exe b/builds/HentaiGameManager.exe index 60a8447..c5db734 100644 Binary files a/builds/HentaiGameManager.exe and b/builds/HentaiGameManager.exe differ diff --git a/builds/HentaiGameManager.jar b/builds/HentaiGameManager.jar index 944fb87..bbd8a8b 100644 Binary files a/builds/HentaiGameManager.jar and b/builds/HentaiGameManager.jar differ diff --git a/libs/commons-lang3-3.13.0.jar b/libs/commons-lang3-3.13.0.jar deleted file mode 100644 index 891540f..0000000 Binary files a/libs/commons-lang3-3.13.0.jar and /dev/null differ diff --git a/libs/opencsv-5.8.jar b/libs/opencsv-5.8.jar deleted file mode 100644 index e4ec7dd..0000000 Binary files a/libs/opencsv-5.8.jar and /dev/null differ diff --git a/src/main/langLoad.java b/src/main/langLoad.java index d4ea145..d26b8e6 100644 --- a/src/main/langLoad.java +++ b/src/main/langLoad.java @@ -1,14 +1,10 @@ package main; -import java.io.FileInputStream; -import java.io.InputStreamReader; +import java.io.BufferedReader; +import java.io.FileReader; import javax.swing.JOptionPane; -import com.opencsv.CSVParserBuilder; -import com.opencsv.CSVReader; -import com.opencsv.CSVReaderBuilder; - import folderHandle.loadSaveGamesSettings.loadSettingsFromXml; public class langLoad { @@ -17,42 +13,37 @@ public class langLoad { tempjLaPa = new String[30], tempjRaBu = new String[30], tempbuton = new String[30], tempFold = new String[30], tempSear = new String[30], tempRand = new String[30]; public static String[] base, basic, tabl, jlapa, jrabu, buton, folder, serc, rand; - private static CSVReader reader = null; public static String[] langChoices, lanMeans; public static void loadLanguages() { - for (int i = 0; i < 30; i++) { - tempBase[i] = null; tempBasic[i] = null; tempTabl[i] = null; tempjLaPa[i] = null; - tempjRaBu[i] = null; tempbuton[i] = null; tempFold[i] = null; tempSear[i] = null; - tempRand[i] = null; - } - String language = loadSettingsFromXml.loadStringSettings("language")[0]; + Integer temp = 0; + String lastLang = "", split = ";", langFromConfig = "english"; + String[] tempAr = new String[30]; + int langindex = 0; + BufferedReader br = null; + try { - // parsing a CSV file into CSVReader class constructor - reader = new CSVReaderBuilder( - new InputStreamReader( new FileInputStream(path+"language.csv"), "utf-8") - ).withCSVParser( new CSVParserBuilder().withSeparator(';').build()).build(); + // parsing a CSV file into BufferedReader class constructor + br = new BufferedReader(new FileReader(path+"language.csv")); } catch (Exception e) { e.printStackTrace(); - JOptionPane.showMessageDialog(null, "Error loading language csv (loadLanguages)", "Error", JOptionPane.ERROR_MESSAGE); - return; + JOptionPane.showMessageDialog(null, "Error language file (loadLanguages)", "Error", JOptionPane.ERROR_MESSAGE); } - if (language == null || reader == null) { return; } - try { - String[] nextLine = reader.readNext(); - langChoices = new String[nextLine.length-1]; - lanMeans = new String[nextLine.length-1]; - // first line is the language names - int langindex = 0; - for (int i = 0; i < nextLine.length; i++) { if (nextLine[i].equals(language)) { langindex = i; break; } } + if (br == null) { return; } + try{ + langFromConfig = loadSettingsFromXml.loadStringSettings("language")[0]; + String[] languages = br.readLine().split(split);// first line is the language names + lanMeans = new String[languages.length-1]; + langChoices = new String[languages.length-1]; + for (int i = 0; i < languages.length; i++) { if (languages[i].equals(langFromConfig)) { langindex = i; break; } } if (langindex == 0) { langindex = 1; } - for (int i = 0; i < (nextLine.length-1); i++) { langChoices[i] = nextLine[i+1]; } - nextLine = reader.readNext(); - for (int i = 0; i < (nextLine.length-1); i++) { lanMeans[i] = nextLine[i+1]; } - // System.out.println("Currently has " +(nextLine.length-1)+ " languages, choosen: "+nextLine[langindex]); - Integer temp = 0; String lastLang = ""; - String[] tempAr = new String[30]; - while ((nextLine = reader.readNext()) != null) { + for (int i = 0; i < (languages.length-1); i++) { langChoices[i] = languages[i+1]; } + languages = br.readLine().split(split); // Second line is language in own language + for (int i = 0; i < (languages.length-1); i++) { lanMeans[i] = languages[i+1]; } + + String line = ""; + while ((line = br.readLine()) != null) { // returns a Boolean value + String[] nextLine = line.split(split); // use comma as separator if (!lastLang.equals(nextLine[0])) { lastLang = nextLine[0]; temp = 0; @@ -77,6 +68,7 @@ public static void loadLanguages() { base = tempBase; basic = tempBasic; tabl = tempTabl; jlapa = tempjLaPa; jrabu = tempjRaBu; buton = tempbuton; folder = tempFold; serc = tempSear; rand = tempRand; + br.close(); return; } catch (Exception e) { e.printStackTrace();