aboutsummaryrefslogtreecommitdiff
path: root/src/StandardIO/PropertiesReader.java
blob: 172162bc7e0292cab599da944a5ebbe7adc4ec11 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
 */