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

35
LINES

< > BotCompany Repo | #1008882 // woodyLoadRules

JavaX fragment (include)

1  
static void woodyLoadRules(WoodyBot bot) {
2  
  woodyBot(bot);
3  
  bot.rules.clear();
4  
  
5  
  L<S> names = endingWithIC(".ctx", bot.fileNames());
6  
  
7  
  // Find disabled folders
8  
  for ping (S name : names) {
9  
    L<S> lines = lines(bot.getFile(name));
10  
11  
    SS properties = ctxParseProperties(lines, 0).a;
12  
    if (eq(properties.get("PROCESS"), "NO")) {
13  
      S folder = dropFromLastSlash(name);
14  
      if (bot.disabledFolders.add(folder + "."))
15  
        print("Disabling folder: " + folder);
16  
    }
17  
  }
18  
    
19  
  for ping (S name : names) {
20  
    L<S> lines = lines(bot.getFile(name));
21  
    S folder = dropFromLastSlash(name);
22  
    if (woodyIsDisabledFolder(folder)) {
23  
      print("Disabled: " + name);
24  
      continue;
25  
    }
26  
    
27  
    for i, S s over lines: {
28  
      if (javaTokC(s).contains("RULE")) pcall { 
29  
        WoodyRule rule = getWoodyRuleFromSource(lines, i);
30  
        rule.fullName = "Agent#" + folder.replace('/', '.') + "." + rule.nameInFile;
31  
        bot.rules.put(rule.fullName, rule);
32  
      }
33  
    }
34  
  }
35  
}

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: 700 / 678
Version history: 9 change(s)
Referenced in: [show references]