Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

35
LINES

< > BotCompany Repo | #1008882 // woodyLoadRules

JavaX fragment (include)

static void woodyLoadRules(WoodyBot bot) {
  woodyBot(bot);
  bot.rules.clear();
  
  L<S> names = endingWithIC(".ctx", bot.fileNames());
  
  // Find disabled folders
  for ping (S name : names) {
    L<S> lines = lines(bot.getFile(name));

    SS properties = ctxParseProperties(lines, 0).a;
    if (eq(properties.get("PROCESS"), "NO")) {
      S folder = dropFromLastSlash(name);
      if (bot.disabledFolders.add(folder + "."))
        print("Disabling folder: " + folder);
    }
  }
    
  for ping (S name : names) {
    L<S> lines = lines(bot.getFile(name));
    S folder = dropFromLastSlash(name);
    if (woodyIsDisabledFolder(folder)) {
      print("Disabled: " + name);
      continue;
    }
    
    for i, S s over lines: {
      if (javaTokC(s).contains("RULE")) pcall { 
        WoodyRule rule = getWoodyRuleFromSource(lines, i);
        rule.fullName = "Agent#" + folder.replace('/', '.') + "." + rule.nameInFile;
        bot.rules.put(rule.fullName, rule);
      }
    }
  }
}

download  show line numbers  debug dex  old transpilations   

Travelled to 13 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1008882
Snippet name: woodyLoadRules
Eternal ID of this version: #1008882/10
Text MD5: f97fb7d6083ee9a39cdc24af7a9f84e2
Author: stefan
Category: javax / a.i.
Type: JavaX fragment (include)
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2017-07-01 18:54:16
Source code size: 1027 bytes / 35 lines
Pitched / IR pitched: No / No
Views / Downloads: 699 / 677
Version history: 9 change(s)
Referenced in: #1006654 - Standard functions list 2 (LIVE, continuation of #761)