From 88984c8887072d058cf443fd7eee68808130b461 Mon Sep 17 00:00:00 2001 From: TekH Date: Mon, 20 Jul 2026 09:46:44 +0200 Subject: [PATCH] Refactor and streamline codebase - Removed `` elements in `DocumentOperator.Domain.csproj` and replaced them with ``, ``, and `` to exclude specific directories. - Removed unused `using DocumentOperator.Domain.Exceptions;` directive. - Simplified `Split` method syntax for delimiter specification. - Updated `return` statements to use concise parameter syntax. - Removed page number validation logic in `DevExpressSwissQrCodeProcessor`. - Replaced default page scanning logic with modern range expression. - Overall, improved code clarity, reduced redundancy, and modernized syntax. --- DocumentOperator.Domain/DocumentOperator.Domain.csproj | 8 ++++++-- .../QrCodeProcessing/DevExpressSwissQrCodeProcessor.cs | 10 ++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/DocumentOperator.Domain/DocumentOperator.Domain.csproj b/DocumentOperator.Domain/DocumentOperator.Domain.csproj index df81c18..17aac08 100644 --- a/DocumentOperator.Domain/DocumentOperator.Domain.csproj +++ b/DocumentOperator.Domain/DocumentOperator.Domain.csproj @@ -7,8 +7,12 @@ - - + + + + + + diff --git a/DocumentOperator.Infrastructure/Services/QrCodeProcessing/DevExpressSwissQrCodeProcessor.cs b/DocumentOperator.Infrastructure/Services/QrCodeProcessing/DevExpressSwissQrCodeProcessor.cs index 1854ab3..7d50f42 100644 --- a/DocumentOperator.Infrastructure/Services/QrCodeProcessing/DevExpressSwissQrCodeProcessor.cs +++ b/DocumentOperator.Infrastructure/Services/QrCodeProcessing/DevExpressSwissQrCodeProcessor.cs @@ -3,11 +3,9 @@ using DevExpress.Drawing; using DevExpress.Pdf; using DocumentOperator.Application.Common.Interfaces; using DocumentOperator.Domain.Common.Exceptions; -using DocumentOperator.Domain.Exceptions; using SkiaSharp; using SkiaSharp.QrCode; using System.Collections.Concurrent; -using System.Runtime.Versioning; namespace DocumentOperator.Infrastructure.Services.QrCodeProcessing; @@ -85,11 +83,11 @@ public sealed class DevExpressSwissQrCodeProcessor : ISwissQrCodeProcessor // Split raw text into lines (handle both \r\n and \n) // Remove leading/trailing \r and \n from each line var rawLines = qrText - .Split(new[] { "\r\n", "\n" }, StringSplitOptions.None) + .Split(["\r\n", "\n"], StringSplitOptions.None) .Select(line => line.Trim('\r', '\n')) .ToArray(); - return (success: true, bill: bill, rawLines: rawLines, pageNumber: imageData.pageNumber); + return (success: true, bill, rawLines, imageData.pageNumber); } catch { @@ -125,14 +123,10 @@ public sealed class DevExpressSwissQrCodeProcessor : ISwissQrCodeProcessor { // Validate page numbers foreach (int pageNum in pageNumbers) - { if (pageNum < 1 || pageNum > totalPages) - { throw new ArgumentException( $"Invalid page number {pageNum}. Document has {totalPages} pages.", nameof(pageNumbers)); - } - } return pageNumbers; }