Exemplo n.º 1
0
        static public int Configure(string githubConfigFile)
        {
            GithubConfiguration githubFoncifguration = new GithubConfiguration();
            JsonSerializer      jsonSerializer       = new JsonSerializer();

            // Read configuration if exist
            if (File.Exists(githubConfigFile))
            {
                StreamReader streamReader = new StreamReader(githubConfigFile);
                Newtonsoft.Json.JsonTextReader jsonTextReader = new JsonTextReader(streamReader);
                githubFoncifguration = jsonSerializer.Deserialize <GithubConfiguration>(jsonTextReader);
                jsonTextReader.Close();
                streamReader.Close();
            }

            // Show dialog
            GithubConfigurationForm githubConfigurationForm = new GithubConfigurationForm(githubFoncifguration);

            if (githubConfigurationForm.ShowDialog() == false)
            {
                return(-1);
            }

            // Write configuration
            githubFoncifguration = githubConfigurationForm.ExportGithubConfiguration();
            StreamWriter streamWriter = new StreamWriter(githubConfigFile);

            jsonSerializer.Serialize(streamWriter, githubFoncifguration);
            streamWriter.Close();

            return(0);
        }
 public GithubService(ILogger <GithubService> logger, IOptions <GithubConfiguration> githubConfiguration, GitHubClient client)
 {
     NullChecker.IsNotNull(logger, nameof(logger));
     _logger = logger;
     _githubConfiguration = githubConfiguration.Value;
     _client             = client;
     _client.Credentials = new Credentials(_githubConfiguration.ClientId, _githubConfiguration.ClientSecret);
 }
 public GithubService(
     IWebHostService webHostService,
     IStudentRepository studentRepository,
     IOptions <GithubConfiguration> githubOptions,
     IOptions <HookConfiguration> hookOptions
     )
 {
     _webHostService      = webHostService;
     _studentRepository   = studentRepository;
     _githubConfiguration = githubOptions.Value;
     _hookConfiguration   = hookOptions.Value;
 }
Exemplo n.º 4
0
        public GitHubMonitor(SlackClient client, GithubConfiguration configuration)
            : base(client, configuration)
        {
            _configuration = configuration;

            var credentials  = new Credentials(_configuration.Token);
            var gitHubClient = new GitHubClient(new ProductHeaderValue("post-bot"))
            {
                Credentials = credentials
            };

            _client = new ObservableActivitiesClient(gitHubClient);

            var logger = new ConsoleLogger("GitHub", (name, level) => true, includeScopes: true);

            _activityObserver     = new GitHubActivityProvider(logger);
            _slackMessageProvider = new GitHubSlackMessageProvider(logger, configuration);
        }
 public GitHubSlackMessageProvider(ILogger logger, GithubConfiguration configuration)
 {
     _configuration          = configuration;
     _attachmentTextProvider = new GitHubSlackAttachmentTextProvider(logger, configuration);
 }
Exemplo n.º 6
0
 public GitHubSlackAttachmentTextProvider(ILogger logger, GithubConfiguration configuration)
 {
     _logger        = logger;
     _configuration = configuration;
 }
Exemplo n.º 7
0
 public GithubService(GithubClientFactory githubClientFactory, GithubConfiguration configuration)
 {
     _githubClientFactory = githubClientFactory;
     _configuration       = configuration;
 }