11using System ;
2- using System . Collections . Generic ;
32using System . IO . Abstractions ;
43using System . Threading . Tasks ;
54using AET . ModVerify . App . GameFinder ;
65using AET . ModVerify . App . Reporting ;
76using AET . ModVerify . App . Settings ;
87using AET . ModVerify . App . TargetSelectors ;
9- using AET . ModVerify . Pipeline ;
108using AET . ModVerify . Reporting ;
9+ using AET . ModVerify . Reporting . Baseline ;
10+ using AET . ModVerify . Reporting . Suppressions ;
1111using AnakinRaW . ApplicationBase ;
1212using Microsoft . Extensions . DependencyInjection ;
1313using Microsoft . Extensions . Logging ;
@@ -71,43 +71,55 @@ public async Task<int> ExecuteAsync()
7171
7272 PrintAction ( verificationTarget ) ;
7373
74- var allErrors = await VerifyTargetAsync ( verificationTarget )
74+ var verificationResult = await VerifyTargetAsync ( verificationTarget )
7575 . ConfigureAwait ( false ) ;
7676
77- return await ProcessVerifyFindings ( verificationTarget , allErrors ) ;
77+ return await ProcessResult ( verificationResult ) ;
7878 }
7979
80- protected abstract Task < int > ProcessVerifyFindings (
81- VerificationTarget verificationTarget ,
82- IReadOnlyCollection < VerificationError > allErrors ) ;
80+ protected abstract Task < int > ProcessResult ( VerificationResult result ) ;
8381
8482 protected abstract VerificationBaseline GetBaseline ( VerificationTarget verificationTarget ) ;
8583
86- private async Task < IReadOnlyCollection < VerificationError > > VerifyTargetAsync ( VerificationTarget verificationTarget )
84+ private async Task < VerificationResult > VerifyTargetAsync ( VerificationTarget verificationTarget )
8785 {
8886 var progressReporter = new VerifyConsoleProgressReporter ( verificationTarget . Name , Settings . ReportSettings ) ;
8987
9088 var baseline = GetBaseline ( verificationTarget ) ;
9189 var suppressions = GetSuppressions ( ) ;
9290
93- using var verifyPipeline = new GameVerifyPipeline (
94- verificationTarget ,
95- Settings . VerifyPipelineSettings ,
96- progressReporter ,
97- new EngineInitializeProgressReporter ( verificationTarget . Engine ) ,
98- baseline ,
99- suppressions ,
100- ServiceProvider ) ;
101-
10291 try
10392 {
93+ var verifierService = ServiceProvider . GetRequiredService < IGameVerifierService > ( ) ;
94+
10495 Logger ? . LogInformation ( ModVerifyConstants . ConsoleEventId , "Verifying '{Target}'..." , verificationTarget . Name ) ;
105- await verifyPipeline . RunAsync ( ) . ConfigureAwait ( false ) ;
96+
97+ var verificationResult = await verifierService . VerifyAsync (
98+ verificationTarget ,
99+ Settings . VerifierServiceSettings ,
100+ baseline ,
101+ suppressions ,
102+ progressReporter ,
103+ new EngineInitializeProgressReporter ( verificationTarget . Engine ) ) ;
104+
106105 progressReporter . Report ( string . Empty , 1.0 ) ;
107- }
108- catch ( OperationCanceledException )
109- {
110- Logger ? . LogWarning ( ModVerifyConstants . ConsoleEventId , "Verification stopped due to enabled failFast setting." ) ;
106+
107+ switch ( verificationResult . Status )
108+ {
109+ case VerificationCompletionStatus . CompletedFailFast :
110+ Logger ? . LogWarning ( ModVerifyConstants . ConsoleEventId , "Verification stopped due to enabled failFast setting." ) ;
111+ break ;
112+ case VerificationCompletionStatus . Cancelled :
113+ Logger ? . LogWarning ( ModVerifyConstants . ConsoleEventId , "Verification was cancelled." ) ;
114+ break ;
115+ case VerificationCompletionStatus . Completed :
116+ default :
117+ Logger ? . LogInformation ( ModVerifyConstants . ConsoleEventId , "Verification completed successfully." ) ;
118+ break ;
119+ }
120+
121+ return verificationResult ;
122+
111123 }
112124 catch ( Exception e )
113125 {
@@ -119,9 +131,6 @@ private async Task<IReadOnlyCollection<VerificationError>> VerifyTargetAsync(Ver
119131 {
120132 progressReporter . Dispose ( ) ;
121133 }
122-
123- Logger ? . LogInformation ( ModVerifyConstants . ConsoleEventId , "Finished verification" ) ;
124- return verifyPipeline . FilteredErrors ;
125134 }
126135
127136 private SuppressionList GetSuppressions ( )
0 commit comments