public List<string> dScriptCheck(string rawYAML) { string fixedYAML = CleandScript(rawYAML); List<string> warnings = new List<string>(); YAMLConfiguration file; try { file = new YAMLConfiguration(fixedYAML); } catch (Exception ex) { Warn(warnings, WarnType.ERROR, "Failed to read YAML: " + ex.Message); return warnings; } List<string> scripts = file.GetKeys(null); for (int i = 0; i < scripts.Count; i++) { dScriptCheckScript(warnings, scripts[i], file.GetConfigurationSection(scripts[i])); } return warnings; }
void InitGitHub() { try { GitHub = new GitHubClient() { Bot = this, ClientToken = Configuration.ReadString("dircbot.github.token", "") }; GitHubConfig = new YAMLConfiguration(File.ReadAllText("data/repositories.yml")); AnnounceGitChannels = new List <string>(); foreach (string chan in BaseChannels) { if (Configuration.ReadString("dircbot.irc-servers." + ServerName + ".channels." + chan.Replace("#", "") + ".announce_github", "false").StartsWith("t")) { Logger.Output(LogType.INFO, "Watching commits in channel: " + chan); AnnounceGitChannels.Add("#" + chan); } } GitHub.FetchRateLimit(); foreach (string author in GitHubConfig.GetKeys(null)) { foreach (string repository in GitHubConfig.GetKeys(author)) { YAMLConfiguration repoConfig = GitHubConfig.GetConfigurationSection(author + "." + repository); bool hasIssues = repoConfig.ReadString("has_issues", "false").StartsWith("t"); bool hasComments = repoConfig.ReadString("has_comments", "false").StartsWith("t"); bool hasPulls = repoConfig.ReadString("has_pulls", "false").StartsWith("t"); GitHub.WatchRepository(author + "/" + repository, hasIssues, hasComments, hasPulls); Logger.Output(LogType.INFO, "Watching: " + author + "/" + repository); } } GitHub.StartWatching(); } catch (Exception ex) { Logger.Output(LogType.ERROR, "Failed to initialize GitHubEngine: " + ex.ToString()); } }
public List <string> dScriptCheck(string rawYAML) { string fixedYAML = CleandScript(rawYAML); List <string> warnings = new List <string>(); YAMLConfiguration file; try { file = new YAMLConfiguration(fixedYAML); } catch (Exception ex) { Warn(warnings, WarnType.ERROR, "Failed to read YAML: " + ex.Message); return(warnings); } List <string> scripts = file.GetKeys(null); for (int i = 0; i < scripts.Count; i++) { dScriptCheckScript(warnings, scripts[i], file.GetConfigurationSection(scripts[i])); } return(warnings); }
void InitGitHub() { try { GitHub = new GitHubClient() { Bot = this, ClientToken = Configuration.ReadString("dircbot.github.token", "") }; GitHubConfig = new YAMLConfiguration(File.ReadAllText("data/repositories.yml")); AnnounceGitChannels = new List<string>(); foreach (string chan in BaseChannels) { if (Configuration.ReadString("dircbot.irc-servers." + ServerName + ".channels." + chan.Replace("#", "") + ".announce_github", "false").StartsWith("t")) { Logger.Output(LogType.INFO, "Watching commits in channel: " + chan); AnnounceGitChannels.Add("#" + chan); } } GitHub.FetchRateLimit(); foreach (string author in GitHubConfig.GetKeys(null)) { foreach (string repository in GitHubConfig.GetKeys(author)) { YAMLConfiguration repoConfig = GitHubConfig.GetConfigurationSection(author + "." + repository); bool hasIssues = repoConfig.ReadString("has_issues", "false").StartsWith("t"); bool hasComments = repoConfig.ReadString("has_comments", "false").StartsWith("t"); bool hasPulls = repoConfig.ReadString("has_pulls", "false").StartsWith("t"); GitHub.WatchRepository(author + "/" + repository, hasIssues, hasComments, hasPulls); Logger.Output(LogType.INFO, "Watching: " + author + "/" + repository); } } GitHub.StartWatching(); } catch (Exception ex) { Logger.Output(LogType.ERROR, "Failed to initialize GitHubEngine: " + ex.ToString()); } }