Xsator

BotScript file reader v0.1

Jan 11th, 2023
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.10 KB | None | 0 0
  1. XCharStream stream = new XCharStream();
  2.         String[] s = file.split("\n");
  3.         List<String> section;
  4.         List<String> str;
  5.         String ch = "";
  6.         String name = "";
  7.         String value = "";
  8.         String lastSection = "";
  9.         Boolean writeSection = false;
  10.         for(int i = 0; i < s.length;) {
  11.             stream = new XCharStream(s[i].replace(" ", ""));
  12.             Instance.sendMsg(stream.getString());
  13.             section = new ArrayList<String>();
  14.             str = new ArrayList<String>();
  15.             name = "";
  16.             value = "";
  17.             writeSection = false;
  18.             while(true) {
  19.                 ch = stream.next();
  20.                 if(ch == "-1") {
  21.                     if(writeSection == false) {
  22.                         if(value == "") {
  23.                             File.put(name, new ArrayList<String>());
  24.                             lastSection = name;
  25.                         } else {
  26.                             section.add(value);
  27.                             File.put(name, section);
  28.                         }
  29.                     } else {
  30.                         value = str.toString();
  31.                         File.get(lastSection).add(value);
  32.                     }
  33.                 }
  34.                 if(ch == ":") {
  35.                     if((stream.getSize() - stream.getPosition()) < stream.getSize()) {
  36.                         name = str.toString();
  37.                     }
  38.                 }
  39.                 if(ch == "-" && stream.getPosition() == 0) writeSection = true;
  40.                 str.add(ch);
  41.             }
  42.         }
Advertisement
Add Comment
Please, Sign In to add comment