Package fr.formiko.kokcinelo.tools
Class Files
java.lang.Object
fr.formiko.kokcinelo.tools.Files
Tool class to manage files.
- Since:
- 0.2
- Version:
- 0.2
-
Method Summary
Modifier and TypeMethodDescriptionstatic String
static int
getNumberOfText
(String languageCode) Get the translated text from a json file.listSubDirectory
(String path) static Set<com.badlogic.gdx.files.FileHandle>
static String
loadContentOfFile
(com.badlogic.gdx.files.FileHandle file, boolean fromAssets) Load the content of a file and all its subfiles.loadFromFile
(String fileName, boolean internal) Load a map from a file.loadMapFromCSVFile
(String fileName, boolean internal) Load a map from a file.static String
Load all existing char in the translation files.static void
saveInFile
(String fileName, Map<String, String> content) Save a map in a file.static void
saveMapToCSVFile
(String fileName, Map<String, ?> map) Save a map from a file.
-
Method Details
-
getDataPath
- Returns:
- the data path depending of the OS.
-
getText
Get the translated text from a json file. The file must be in the folder languages and have the name of the language code.- Parameters:
languageCode
- language 2 or 3 char code of the file to load.- Returns:
- the translated text.
-
getNumberOfText
- Returns:
- The list of not null keys.
-
saveInFile
Save a map in a file.- Parameters:
fileName
- name of the file to save data incontent
- data to save in file
-
loadFromFile
Load a map from a file.- Parameters:
fileName
- name of the file to load data frominternal
- if the file is internal or not- Returns:
- the data loaded from file
-
loadMapFromCSVFile
Load a map from a file.- Parameters:
fileName
- name of the file to load data from- Returns:
- the data loaded from file
-
saveMapToCSVFile
Save a map from a file.- Parameters:
fileName
- name of the file to load data frommap
- the map to save
-
loadUniqueCharFromTranslationFiles
Load all existing char in the translation files. (And subsubfiles, and subsubsubfiles, etc.) It is used to know which char are used in the translation files to create the BitmapFont.- Returns:
- all char that may be displayed from translation files.
-
loadContentOfFile
Load the content of a file and all its subfiles. (And subsubfiles, and subsubsubfiles, etc.) Don't work for internal files.- Parameters:
file
- the file were to search.- Returns:
- all content of the file and its subfiles.
-
listSubFilesPathsRecusvively
- Parameters:
path
- the path of the directory to search- Returns:
- all subfiles of a directory. (& sub sub files, & sub sub sub files, etc.)
-
listSubFilesRecusvively
- Parameters:
path
- the path of the directory to search- Returns:
- all subfiles of a directory. (& sub sub files, & sub sub sub files, etc.)
-
listSubDirectory
- Parameters:
path
- the path of the directory to search- Returns:
- direct directory of a directory
-