Пример #1
0
        private static async Task GetFileBySha256Async(GetFileBySha256Options options,
                                                       CancellationToken cancellationToken = default)
        {
            CLIENT.IEvaluationService evaluationService = CreateService(options);

            CLIENT.EvaluationFile evaluationFile = await evaluationService.GetFileBySha256(options.Hash, cancellationToken);

            WriteOutput(evaluationFile, options.OutputFormat, Console.Out);
        }
Пример #2
0
        private static async Task GetAsync(GetOptions options,
                                           CancellationToken cancellationToken = default)
        {
            CLIENT.IEvaluationService evaluationService = CreateService(options);

            CLIENT.Evaluation evaluation = await evaluationService.GetAsync(options.Id, cancellationToken);

            WriteOutput(evaluation, options.OutputFormat, Console.Out);
        }
Пример #3
0
        private static CLIENT.IEvaluationService CreateService(OptionsBase options)
        {
            X509Certificate2 clientCertificate = GetCertificate(options);

            HttpClient httpClient = CLIENT.EvaluationServiceFactory.CreateHttpClient(clientCertificate,
                                                                                     userName: options.UserName,
                                                                                     password: options.Password,
                                                                                     serverCertificateCustomValidationCallback: options.NoValidation
                                        ? HttpClientHandler.DangerousAcceptAnyServerCertificateValidator
                                        : null);

            CLIENT.IEvaluationService evaluationService = CLIENT.EvaluationServiceFactory.CreateEvaluationService(options.Url, httpClient);

            return(evaluationService);
        }
Пример #4
0
        private static async Task SubmitAsync(SubmitOptions options,
                                              CancellationToken cancellationToken = default)
        {
            CLIENT.IEvaluationService evaluationService = CreateService(options);

            string correlationID = options.CorrelationID;

            CLIENT.FileParameter[] fileParameters = options.InputFileNames
                                                    .Select(x => new CLIENT.FileParameter
            {
                FileName = x,
            })
                                                    .ToArray();

            string id = await evaluationService.SubmitAsync(fileParameters, correlationID, cancellationToken);

            WriteOutput(id, options.OutputFormat, Console.Out);
        }