internal int LoadUsers0(string key, string from) { Regex regex = new Regex(key, RegexOptions.IgnoreCase); int users = 0; string k1 = key.Replace("_", " "); foreach (string fsn in HostSystem.GetDirectories(from)) { var files = HostSystem.GetFiles(fsn, "*.xml"); if (files == null || files.Length == 0) { continue; } string s = fsn; if (fsn.StartsWith(from)) { s = s.Substring(from.Length); } if (s.StartsWith("/")) { s = s.Substring(1); } if (s.StartsWith("\\")) { s = s.Substring(1); } if (regex.IsMatch(s)) { string name = s.Replace("_", " ").Replace("~", " ").Replace(" ", " "); MasterUser user = (MasterUser)FindOrCreateUser(name); user.UserDirectory = user.UserDirectory ?? fsn; users++; } } return(users); }
protected override Unifiable ProcessChangeU() { if (CheckNode("dbload")) { // Simply push the filled in tag contents onto the stack try { // Find and Replace Unifiable templateNodeInnerValue = Recurse(); string path = (string)templateNodeInnerValue; path = path.Trim(); string[] files = HostSystem.GetFiles(path); if (files != null && files.Length > 0) { AddSideEffect("DBLOAD " + path, () => { foreach (string file in files) { TargetBot.LuceneIndexer.LoadDocuments(file, templateNode); } }); return("@echo DBLOAD " + path); } else { Console.WriteLine("WARNING: dbload cannot find file :{0}", path); } } catch (Exception e) { writeToLog("ERROR: {0}", e); } } return(Unifiable.Empty); }