Beispiel #1
0
        /// <summary>
        /// Create a searcher.
        /// </summary>
        /// <returns>The searcher that is created.</returns>
        public override Searcher CreateSearcher(GitHubClient client, int maximumCount)
        {
            previous = this;

            List <DateTime> dates = new List <DateTime>();
            int             year  = 2015;

            while (year < 2020)
            {
                int i = 1;
                while (i < 13)
                {
                    dates.Add(new DateTime(year, i, 1));
                    i++;
                }
                ;
                year++;
            }

            var request = CreateRequest();

            foreach (var d in dates)
            {
                DateRange range = new DateRange(d, new DateTime(d.Year, d.Month, 1).AddMonths(1).AddDays(-1));
                request.Created = range;
                var result = new RepositorySearcher(client, maximumCount, request);
            }
            // return new RepositorySearcher(client, maximumCount, request);
            throw new NotImplementedException();
        }
Beispiel #2
0
        private async void Search2 <TBroker>()
            where TBroker : ISearchBroker, new()
        {
            repos.Clear();
            paths.Clear();
            var broker = new SearchRepositoriesBroker();

            //using (var dialog = new SearchCriteriaForm { SelectedObject = broker })
            //	if (dialog.ShowDialog(this) == DialogResult.OK)

            broker.Term  = "IdealAutomatex";
            searchResult = await CreateSearcher(broker).SearchAsync();

            //searchResult = searcher.Search();
            foreach (var item in ((SearchResult <Octokit.Repository>)(searchResult)).Items)
            {
                repos.Add(item.Owner.Login + "/" + item.Name);
                Console.WriteLine(item.Name);
            }
            //	BeginWork(BackgroundType.Search, CreateSearcher(broker));
            // ((SearchResult<Octokit.Repository>)(searchResult)).Items


            var brokerx = new SearchCodeBroker();

            using (var dialog = new SearchCriteriaForm {
                SelectedObject = brokerx
            })
                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    int totalCount = 0;
                    foreach (var item in repos)
                    {
                        brokerx.Repos = item;
                        searchResult  = await CreateSearcher(brokerx).SearchAsync();

                        //searchResult = searcher.Search();
                        foreach (var itemx in ((SearchResult <Octokit.SearchCode>)(searchResult)).Items)
                        {
                            totalCount++;
                            paths.Add(itemx);
                            // paths.Add(itemx.Repository.FullName + "/" + itemx.Path);
                            Console.WriteLine(itemx.Repository.FullName + "/" + itemx.Path);
                        }
                    }
                    SearchResult <Octokit.SearchCode> bigSearchResult = new SearchResult <SearchCode>(totalCount, false,
                                                                                                      new ReadOnlyCollection <SearchCode>(paths));

                    mainDataGridView.DataSource = null;
                    this.searcher = CreateSearcher(brokerx);
                    mainDataGridView.DataSource = bigSearchResult.DataSource;
                }
            CompleteSearch();
        }
        private SearchRepositoriesBroker(SearchRepositoriesBroker other)
            : base(other)
        {
            if (other == null)
            {
                return;
            }

            Archived  = other.Archived;
            Created   = new DateRangeBroker(other.Created);
            Fork      = other.Fork;
            Forks     = new Int32RangeBroker(other.Forks);
            In        = new List <InQualifier>(other.In);
            Language  = other.Language;
            Size      = new Int32RangeBroker(other.Size);
            SortField = other.SortField;
            Stars     = new Int32RangeBroker(other.Stars);
            Updated   = new DateRangeBroker(other.Updated);
            User      = other.User;
        }
 /// <summary>
 /// Create a searcher.
 /// </summary>
 /// <returns>The searcher that is created.</returns>
 public override Searcher CreateSearcher(GitHubClient client, int maximumCount)
 {
     previous = this;
     return(new RepositorySearcher(client, maximumCount, CreateRequest()));
 }