1 package rero.dialogs.help; 2 3 import java.io.*; 4 import rero.config.*; 5 import java.util.*; 6 7 import rero.util.*; 8 import java.net.*; 9 10 public class HelpData 11 { 12 protected LinkedList aliases = new LinkedList(); 13 protected HashMap data = new HashMap(); 14 15 public Object [] getData() 16 { 17 return aliases.toArray(); 18 } 19 20 public LinkedList getAliases() 21 { 22 return aliases; 23 } 24 25 public String getCommand(String command) 26 { 27 return ((HelpCommand)data.get(command)).toString(); 28 } 29 30 public boolean isCommand(String command) 31 { 32 return data.containsKey(command); 33 } 34 35 public HelpData() 36 { 37 URL url = ClientState.getClientState().getPackagedResource("aliases", "help"); 38 39 if (url != null) 40 { 41 try 42 { 43 BufferedReader in = new BufferedReader(new InputStreamReader(url.openStream())); 44 45 String text; 46 while ((text = in.readLine()) != null) 47 { 48 String [] temp = text.split("\\:\\:"); 49 aliases.add(temp[0]); 50 data.put(temp[0], new HelpCommand(temp)); 51 } 52 } 53 catch (Exception ex) 54 { 55 ex.printStackTrace(); 56 } 57 } 58 59 } 60 } 61 | Popular Tags |