Example #1
0
        protected override void UpdateUI()
        {
            if (BACKUP_SETTINGS_SERVICE != null)
            {
                m_serviceSettings = BACKUP_SETTINGS_SERVICE.Get(GithubBackupService.SERVICE_ID);
                GithubSettings bbSettings = m_serviceSettings as GithubSettings;

                Username = bbSettings.Username;
                TokenKey = bbSettings.PublicKey;

                Repositories = new ObservableCollection <RepositoriesViewDto>();
                List <Octokit.Repository> repos = GithubService.GetAllRepositories();
                if (repos != null)
                {
                    foreach (Octokit.Repository repo in repos)
                    {
                        Repositories.Add(new RepositoriesViewDto()
                        {
                            RepoName = repo.Name,
                            Owner    = repo.Owner.Login,
                            PicUrl   = repo.Owner.AvatarUrl,
                        });
                    }
                }
                NotifyOfPropertyChange(() => IsInvalidCredentials);
            }
        }
Example #2
0
        public GithubAppTokenService(IOptions <GithubSettings> options)
        {
            _settings = options.Value;
            var rsaParameters = CryptoHelper.GetRsaParameters(_settings.PrivateKey);
            var key           = new RsaSecurityKey(rsaParameters);

            _signingCredentials = new SigningCredentials(key, SecurityAlgorithms.RsaSha256);
        }
Example #3
0
        public GithubService(GithubSettings settings)
        {
            _settings           = settings;
            _client             = new HttpClient();
            _client.BaseAddress = new Uri("https://api.github.com");
            _client.DefaultRequestHeaders.Accept.Add(
                new MediaTypeWithQualityHeaderValue("application/vnd.github.v3+json")
                );
            _client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("token", _settings.GithubApiToken);
            _client.DefaultRequestHeaders.UserAgent.Add(new ProductInfoHeaderValue("ReleaseNotes", "0.0.1"));

            _serializer = new DataContractJsonSerializer(typeof(List <PullRequest>));
        }
 public UserSettingsManager()
 {
     GithubSettings = new GithubSettings();
     if (File.Exists(RepositoriesSettingFile))
     {
         try
         {
             string data = File.ReadAllText(RepositoriesSettingFile);
             GithubSettings = JsonConvert.DeserializeObject <GithubSettings>(data);
         }
         catch (Exception ex)
         {
             Template.Managers.LogManager.Instance.LogCritical($"Unable to read file {RepositoriesSettingFile}: {ex}", "");
         }
     }
 }
Example #5
0
        static int Main(string[] args)
        {
            var configuration = new ConfigurationBuilder()
                                .SetBasePath(Directory.GetCurrentDirectory())
                                .AddJsonFile("appsettings.json", optional: true, reloadOnChange: false)
                                .AddEnvironmentVariables("ChangeLog:")
                                .AddCommandLine(args)
                                .Build();

            var githubSettings = new GithubSettings();

            configuration.Bind(githubSettings);

            var gitSettings = new GitSettings();

            configuration.Bind(gitSettings);

            var cosmosDbSettings = new CosmosDbSettings();

            configuration.Bind(cosmosDbSettings);

            var gitHubService          = new GithubService(githubSettings);
            var gitService             = new GitService(gitSettings);
            var cosmoDbRepository      = new CosmosDbRepository(cosmosDbSettings);
            var directAccessRepository = new DirectAccessChangeLogRepository(gitHubService, gitService);

            var app = new CommandLineApplication();

            app.HelpOption(inherited: true);

            var showCommand = new ShowCommand(cosmoDbRepository, directAccessRepository);
            var loadCommand = new LoadCommand(cosmoDbRepository, directAccessRepository);

            app.Command("show", showCommand.Configure);
            app.Command("load", loadCommand.Configure);

            app.OnExecute(() =>
            {
                Console.WriteLine("Specify a subcommand");
                app.ShowHelp();
                return(1);
            });

            return(app.Execute(args));
        }
 public GithubPayloadValidator(IOptions <GithubSettings> options)
 {
     _settings = options.Value;
 }
Example #7
0
 public GithubService(IGitHubClient githubClient, IOptions <GithubSettings> options)
 {
     _githubClient   = githubClient;
     _githubSettings = options.Value;
 }
Example #8
0
 public Github()
 {
     Initalize();
     Settings = new GithubSettings();
     NavigateTo(Url);
 }
Example #9
0
 public CommitStatusWriter(IOptions <GithubSettings> options)
 {
     _settings = options.Value;
 }