aboutsummaryrefslogtreecommitdiff
path: root/src/StandardIO/PropertiesReader.java
diff options
context:
space:
mode:
authorJoshua Rahm <joshua.rahm@colorado.edu>2015-01-30 17:11:48 -0700
committerJoshua Rahm <joshua.rahm@colorado.edu>2015-01-30 17:11:48 -0700
commit1c5e38fe69ac8a6decbdd8abe93112f4e3369315 (patch)
tree926cef8cb76d46862ed2c4ec7028720611e47476 /src/StandardIO/PropertiesReader.java
downloadModulus3D-1c5e38fe69ac8a6decbdd8abe93112f4e3369315.tar.gz
Modulus3D-1c5e38fe69ac8a6decbdd8abe93112f4e3369315.tar.bz2
Modulus3D-1c5e38fe69ac8a6decbdd8abe93112f4e3369315.zip
added source
Diffstat (limited to 'src/StandardIO/PropertiesReader.java')
-rw-r--r--src/StandardIO/PropertiesReader.java60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/StandardIO/PropertiesReader.java b/src/StandardIO/PropertiesReader.java
new file mode 100644
index 0000000..172162b
--- /dev/null
+++ b/src/StandardIO/PropertiesReader.java
@@ -0,0 +1,60 @@
+/* */ package StandardIO;
+/* */
+/* */ import StandardIO.FileIO.FileDecomposer;
+/* */ import java.io.BufferedWriter;
+/* */ import java.io.FileWriter;
+/* */ import java.io.IOException;
+/* */ import java.io.PrintStream;
+/* */
+/* */ public class PropertiesReader
+/* */ {
+/* */ private String dir;
+/* */
+/* */ public PropertiesReader(String directory)
+/* */ {
+/* 11 */ this.dir = directory;
+/* */ }
+/* */ public String[] readProperties() {
+/* 14 */ String[] file = new String[0];
+/* 15 */ String[] toReturn = new String[6];
+/* */ try {
+/* 17 */ file = FileDecomposer.decompose(this.dir);
+/* */ }
+/* */ catch (IOException e) {
+/* 20 */ System.out.println("Properties Not Found");
+/* 21 */ return new String[] { "1234567890\\QWERTYUIOP\\ASDFGHJKL\\ZXCVBNM", "none", "none", "none", "full", "false" };
+/* */ }
+/* */
+/* 24 */ for (String str : file) {
+/* 25 */ if (str.startsWith("keyboard-style"))
+/* 26 */ if (str.substring(str.indexOf(":") + 1).trim().equals("QWERTY")) toReturn[0] = "1234567890\\QWERTYUIOP\\ASDFGHJKL\\ZXCVBNM";
+/* 27 */ else if (str.substring(str.indexOf(":") + 1).trim().equals("DVORAK")) toReturn[0] = "1234567890\\PYFGCRL\\AOEUIDHTNS\\QJKXBMWVZ";
+/* 28 */ else if (str.substring(str.indexOf(":") + 1).trim().equals("ALPHABETICAL")) toReturn[0] = "0123456789\\ABCDEFGHIJ\\KLMNOPQRST\\UVWXYZ";
+/* 29 */ if (str.startsWith("keyboard")) toReturn[0] = str.substring(str.indexOf(":") + 1);
+/* 30 */ if (str.startsWith("ColorKeys")) toReturn[1] = str.substring(str.indexOf(":") + 1);
+/* 31 */ if (str.startsWith("LastFunctionDir")) toReturn[2] = str.substring(str.indexOf(":") + 1);
+/* 32 */ if (str.startsWith("LastLoadDir")) toReturn[3] = str.substring(str.indexOf(":") + 1);
+/* 33 */ if (str.startsWith("calcsize:")) toReturn[4] = str.substring(str.indexOf(":") + 1);
+/* 34 */ if (str.startsWith("ontop:")) toReturn[5] = str.substring(str.indexOf(":") + 1);
+/* */ }
+/* 36 */ return toReturn;
+/* */ }
+/* */ public void writeProperties(String[] props) {
+/* 39 */ String[] scrpt = { "keyboard-style:", "ColorKeys:", "LastFunctionDir:", "LastLoadDir:", "calcsize:", "ontop:" };
+/* */ try {
+/* 41 */ BufferedWriter out = new BufferedWriter(new FileWriter(this.dir));
+/* 42 */ for (int i = 0; i < props.length; i++) {
+/* 43 */ out.write(scrpt[i] + props[i] + "\n");
+/* */ }
+/* 45 */ out.close();
+/* */ }
+/* */ catch (IOException localIOException)
+/* */ {
+/* */ }
+/* */ }
+/* */ }
+
+/* Location: Modulus.jar
+ * Qualified Name: StandardIO.PropertiesReader
+ * JD-Core Version: 0.6.2
+ */ \ No newline at end of file