static void Main(string[] args) { Def.Config.DefaultHandlerThrowExceptions = Def.Config.DefaultExceptionBehavior.Never; { var parser = new Def.Parser(); parser.AddFile("xml/config.xml"); parser.Finish(); } var userdb = new UserDb(); foreach (var file in Directory.GetFiles(Config.Global.dataDir, "*.json", SearchOption.AllDirectories).ProgressBar()) { var post = JsonConvert.DeserializeObject <Post>(File.ReadAllText(file)); userdb.Add(post); } var authorized = userdb.AuthorizedUsers().ToArray(); string result = ""; result += "~author: ["; result += string.Join(", ", authorized.OrderBy(user => user)); result += "]"; Dbg.Inf(result); authorized.Shuffle(); Dbg.Inf("Random sample of authorized users: " + string.Join(" ", authorized.Take(20).Select(user => $"/u/{user}"))); }
public override void _Ready() { base._Ready(); Def.Config.InfoHandler = str => GD.Print("INF: " + str); Def.Config.WarningHandler = str => { GD.Print("WRN: " + str); GD.PushWarning(str); }; Def.Config.ErrorHandler = str => { GD.Print("ERR: " + str); GD.PushError(str); }; // Spool up defs system var parser = new Def.Parser(); if (System.IO.File.Exists("curve.xml")) { parser.AddString(System.IO.File.ReadAllText("curve.xml"), "curve.xml"); parser.AddString(System.IO.File.ReadAllText("kezboard.xml"), "kezboard.xml"); } else { foreach (var fname in Util.GetFilesFromDir("res://").Where(fname => !fname.Contains("/.") && fname.EndsWith(".xml"))) { parser.AddString(Util.GetFileAsString(fname), fname); } } parser.Finish(); //if (!OS.IsDebugBuild()) //{ OS.WindowFullscreen = true; //} blocker = new WindowsBlocker(); blocker.Enable(true); }