Beispiel #1
0
        private static void FetchUpdates(QueryFilter queryToRun, CompressedMetadataStore destinationResult)
        {
            var server = new UpstreamServerClient(destinationResult.UpstreamSource);

            server.MetadataQueryProgress += Server_MetadataQueryProgress;

            Console.WriteLine("Fetching categories ...");

            server.GetCategories(destinationResult).GetAwaiter().GetResult();

            if (queryToRun != null)
            {
                Console.WriteLine("Running query with filters:");

                MetadataQuery.PrintFilter(queryToRun, destinationResult);

                server.GetUpdates(queryToRun, destinationResult).GetAwaiter().GetResult();
            }

            Console.WriteLine();
            destinationResult.CommitProgress += Program.MetadataSourceOperationProgressHandler;
            destinationResult.Commit();

            Console.WriteLine();
            ConsoleOutput.WriteGreen($"Query result saved to file {destinationResult.FilePath}");
        }
Beispiel #2
0
        /// <summary>
        /// Gets updates matching the query filter from an upstream update server.
        /// </summary>
        /// <param name="updatesFilter">Updates filter. See <see cref="QueryFilter"/> for details.</param>
        /// <returns>An updates metadata source containing updates that match the filter.</returns>
        public async Task <CompressedMetadataStore> GetUpdates(QueryFilter updatesFilter)
        {
            var queryResult = new CompressedMetadataStore(GetQueryResultFileName(), UpstreamEndpoint);

            await GetUpdates(updatesFilter, queryResult);

            queryResult.Commit();

            return(queryResult);
        }
Beispiel #3
0
        /// <summary>
        /// Gets the list of categories from the upstream update server.
        /// </summary>
        /// <returns>An updates metadata source containing all.</returns>
        public async Task <CompressedMetadataStore> GetCategories()
        {
            var queryResult = new CompressedMetadataStore(GetQueryResultFileName(), UpstreamEndpoint);

            await GetCategories(queryResult);

            queryResult.Commit();

            return(queryResult);
        }