@@ -334,24 +334,24 @@ private GetPrinterAttributesResponse GetGetPrinterAttributesResponse(GetPrinterA
334334 MultipleDocumentJobsSupported = ! IsRequired ( PrinterAttribute . MultipleDocumentJobsSupported ) ? null : true ,
335335 CompressionSupported = ! IsRequired ( PrinterAttribute . CompressionSupported ) ? null : [ Compression . None ] ,
336336 PrinterLocation = ! IsRequired ( PrinterAttribute . PrinterLocation ) ? null : "Internet" ,
337- PrintScalingDefault = ! IsRequired ( PrinterAttribute . PrintScalingDefault ) ? null : options . PrintScaling ,
338- PrintScalingSupported = ! IsRequired ( PrinterAttribute . PrintScalingSupported ) ? null : [ options . PrintScaling ] ,
337+ PrintScalingDefault = ! IsRequired ( PrinterAttribute . PrintScalingDefault ) ? null : options . PrintScaling . FirstOrDefault ( ) ,
338+ PrintScalingSupported = ! IsRequired ( PrinterAttribute . PrintScalingSupported ) ? null : options . PrintScaling ,
339339 PrinterUriSupported = ! IsRequired ( PrinterAttribute . PrinterUriSupported ) ? null : [ GetPrinterUrl ( ) ] ,
340340 UriAuthenticationSupported = ! IsRequired ( PrinterAttribute . UriAuthenticationSupported ) ? null : [ UriAuthentication . None ] ,
341341 UriSecuritySupported = ! IsRequired ( PrinterAttribute . UriSecuritySupported ) ? null : [ GetUriSecuritySupported ( ) ] ,
342342 PrinterUpTime = ! IsRequired ( PrinterAttribute . PrinterUpTime ) ? null : ( int ) ( dateTimeOffsetProvider . UtcNow - _startTime ) . TotalSeconds ,
343- MediaDefault = ! IsRequired ( PrinterAttribute . MediaDefault ) ? null : options . Media ,
344- MediaColDefault = ! IsRequired ( PrinterAttribute . MediaDefault ) ? null : options . Media ,
345- MediaSupported = ! IsRequired ( PrinterAttribute . MediaSupported ) ? null : [ options . Media ] ,
346- SidesDefault = ! IsRequired ( PrinterAttribute . SidesDefault ) ? null : options . Sides ,
343+ MediaDefault = ! IsRequired ( PrinterAttribute . MediaDefault ) ? null : options . Media . FirstOrDefault ( ) ,
344+ MediaColDefault = ! IsRequired ( PrinterAttribute . MediaDefault ) ? null : options . Media . FirstOrDefault ( ) ,
345+ MediaSupported = ! IsRequired ( PrinterAttribute . MediaSupported ) ? null : options . Media ,
346+ SidesDefault = ! IsRequired ( PrinterAttribute . SidesDefault ) ? null : options . Sides . FirstOrDefault ( ) ,
347347 SidesSupported = ! IsRequired ( PrinterAttribute . SidesSupported ) ? null : Enum . GetValues ( typeof ( Sides ) ) . Cast < Sides > ( ) . Where ( x => x != Sides . Unsupported ) . ToArray ( ) ,
348348 PdlOverrideSupported = ! IsRequired ( PrinterAttribute . PdlOverrideSupported ) ? null : "attempted" ,
349349 MultipleOperationTimeOut = ! IsRequired ( PrinterAttribute . MultipleOperationTimeOut ) ? null : 120 ,
350350 FinishingsDefault = ! IsRequired ( PrinterAttribute . FinishingsDefault ) ? null : options . Finishings ,
351- PrinterResolutionDefault = ! IsRequired ( PrinterAttribute . PrinterResolutionDefault ) ? null : options . Resolution ,
352- PrinterResolutionSupported = ! IsRequired ( PrinterAttribute . PrinterResolutionSupported ) ? null : [ options . Resolution ] ,
353- PrintQualityDefault = ! IsRequired ( PrinterAttribute . PrintQualityDefault ) ? null : options . PrintQuality ,
354- PrintQualitySupported = ! IsRequired ( PrinterAttribute . PrintQualitySupported ) ? null : [ options . PrintQuality ] ,
351+ PrinterResolutionDefault = ! IsRequired ( PrinterAttribute . PrinterResolutionDefault ) ? null : options . Resolution . FirstOrDefault ( ) ,
352+ PrinterResolutionSupported = ! IsRequired ( PrinterAttribute . PrinterResolutionSupported ) ? null : [ options . Resolution . FirstOrDefault ( ) ] ,
353+ PrintQualityDefault = ! IsRequired ( PrinterAttribute . PrintQualityDefault ) ? null : options . PrintQuality . FirstOrDefault ( ) ,
354+ PrintQualitySupported = ! IsRequired ( PrinterAttribute . PrintQualitySupported ) ? null : options . PrintQuality ,
355355 JobPriorityDefault = ! IsRequired ( PrinterAttribute . JobPriorityDefault ) ? null : options . JobPriority ,
356356 JobPrioritySupported = ! IsRequired ( PrinterAttribute . JobPrioritySupported ) ? null : options . JobPriority ,
357357 CopiesDefault = ! IsRequired ( PrinterAttribute . CopiesDefault ) ? null : options . Copies ,
@@ -445,10 +445,10 @@ private JobAttributes GetJobAttributes(PrinterJob job, string[]? requestedAttrib
445445 JobStateReasons = ! IsRequired ( JobAttribute . JobState ) ? null : [ JobStateReason . None ] ,
446446 DateTimeAtCreation = ! IsRequired ( JobAttribute . DateTimeAtCreation ) ? null : job . CreatedDateTime ,
447447 TimeAtCreation = ! IsRequired ( JobAttribute . TimeAtCreation ) ? null : ( int ) ( job . CreatedDateTime - _startTime ) . TotalSeconds ,
448- DateTimeAtProcessing = ! IsRequired ( JobAttribute . DateTimeAtProcessing ) ? null : job . ProcessingDateTime ,
449- TimeAtProcessing = ! IsRequired ( JobAttribute . TimeAtProcessing ) || ! job . ProcessingDateTime . HasValue ? null : ( int ) ( job . ProcessingDateTime . Value - _startTime ) . TotalSeconds ,
450- DateTimeAtCompleted = ! IsRequired ( JobAttribute . DateTimeAtCompleted ) ? null : job . CompletedDateTime ,
451- TimeAtCompleted = ! IsRequired ( JobAttribute . TimeAtCompleted ) || ! job . CompletedDateTime . HasValue ? null : ( int ) ( job . CompletedDateTime . Value - _startTime ) . TotalSeconds ,
448+ DateTimeAtProcessing = ! IsRequired ( JobAttribute . DateTimeAtProcessing ) ? null : job . ProcessingDateTime ?? DateTimeOffset . MinValue ,
449+ TimeAtProcessing = ! IsRequired ( JobAttribute . TimeAtProcessing ) ? null : job . ProcessingDateTime . HasValue ? ( int ) ( job . ProcessingDateTime . Value - _startTime ) . TotalSeconds : - 1 ,
450+ DateTimeAtCompleted = ! IsRequired ( JobAttribute . DateTimeAtCompleted ) ? null : job . CompletedDateTime ?? DateTimeOffset . MinValue ,
451+ TimeAtCompleted = ! IsRequired ( JobAttribute . TimeAtCompleted ) ? null : job . CompletedDateTime . HasValue ? ( int ) ( job . CompletedDateTime . Value - _startTime ) . TotalSeconds : - 1 ,
452452 Compression = ! IsRequired ( JobAttribute . Compression ) ? null : documentAttributes ? . Compression ,
453453 DocumentFormat = ! IsRequired ( JobAttribute . DocumentFormat ) ? null : documentAttributes ? . DocumentFormat ,
454454 DocumentName = ! IsRequired ( JobAttribute . DocumentName ) ? null : documentAttributes ? . DocumentName ,
@@ -614,12 +614,12 @@ private string GetPrinterMoreInfo()
614614 private void FillWithDefaultValues ( int jobId , NewJobAttributes attributes )
615615 {
616616 var options = printerOptions . Value ;
617- attributes . PrintScaling ??= options . PrintScaling ;
618- attributes . Sides ??= options . Sides ;
619- attributes . Media ??= options . Media ;
620- attributes . PrinterResolution ??= options . Resolution ;
617+ attributes . PrintScaling ??= options . PrintScaling . FirstOrDefault ( ) ;
618+ attributes . Sides ??= options . Sides . FirstOrDefault ( ) ;
619+ attributes . Media ??= options . Media . FirstOrDefault ( ) ;
620+ attributes . PrinterResolution ??= options . Resolution . FirstOrDefault ( ) ;
621621 attributes . Finishings ??= options . Finishings ;
622- attributes . PrintQuality ??= options . PrintQuality ;
622+ attributes . PrintQuality ??= options . PrintQuality . FirstOrDefault ( ) ;
623623 attributes . JobPriority ??= options . JobPriority ;
624624 attributes . Copies ??= options . Copies ;
625625 attributes . OrientationRequested ??= options . Orientation ;
0 commit comments