mirror of
https://github.com/cyanfish/naps2.git
synced 2024-08-17 19:20:29 +03:00
Fix warnings and comments
This commit is contained in:
parent
4ba463ddec
commit
b7140b8b09
@ -1,7 +1,8 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8</TargetFramework>
|
||||
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">net8-windows</TargetFrameworks>
|
||||
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('Windows'))">net8</TargetFrameworks>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>None</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
|
||||
<Configurations>Debug;Release;DebugLang</Configurations>
|
||||
|
@ -245,7 +245,7 @@ public abstract class ImageContext
|
||||
return RenderFromStorage(image.Storage, (image as IPdfRendererProvider)?.PdfRenderer);
|
||||
}
|
||||
|
||||
private IMemoryImage RenderFromStorage(IImageStorage storage, IPdfRenderer pdfRenderer)
|
||||
private IMemoryImage RenderFromStorage(IImageStorage storage, IPdfRenderer? pdfRenderer)
|
||||
{
|
||||
switch (storage)
|
||||
{
|
||||
|
@ -16,8 +16,7 @@ public static class ImageExtensions
|
||||
/// <param name="image"></param>
|
||||
/// <param name="jpegPath"></param>
|
||||
/// <returns></returns>
|
||||
internal static bool IsUntransformedJpegFile(this IRenderableImage image,
|
||||
[MaybeNullWhen(false)] out string jpegPath)
|
||||
internal static bool IsUntransformedJpegFile(this IRenderableImage image, out string jpegPath)
|
||||
{
|
||||
if (image is { Storage: ImageFileStorage fileStorage, TransformState.IsEmpty: true } &&
|
||||
ImageContext.GetFileFormatFromExtension(fileStorage.FullPath) == ImageFileFormat.Jpeg)
|
||||
@ -25,7 +24,7 @@ public static class ImageExtensions
|
||||
jpegPath = fileStorage.FullPath;
|
||||
return true;
|
||||
}
|
||||
jpegPath = null;
|
||||
jpegPath = null!;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -18,7 +18,6 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
|
||||
<PackageReference Include="Nullable" Version="1.3.1" PrivateAssets="all" />
|
||||
<PackageReference Include="System.Collections.Immutable" Version="8.0.0" />
|
||||
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
|
||||
<PackageReference Include="ZXing.Net" Version="0.16.9" />
|
||||
|
@ -3,6 +3,7 @@ namespace NAPS2.Util;
|
||||
|
||||
public static class AsyncProducers
|
||||
{
|
||||
#pragma warning disable CS1998
|
||||
public static async IAsyncEnumerable<T> Empty<T>()
|
||||
{
|
||||
yield break;
|
||||
|
@ -75,6 +75,7 @@ public static class GLibLogInterceptor
|
||||
nint nFields,
|
||||
IntPtr user_data);
|
||||
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
struct GLogField
|
||||
{
|
||||
public string key;
|
||||
|
@ -169,7 +169,7 @@ public class WinFormsDesktopForm : DesktopForm
|
||||
TextAlign = ContentAlignment.MiddleLeft,
|
||||
Image = Image.FromStream(new MemoryStream(Icons.control_play_blue_small))
|
||||
};
|
||||
item.Click += (_, _) => _desktopScanController.ScanWithProfile((ScanProfile) item.Tag);
|
||||
item.Click += (_, _) => _desktopScanController.ScanWithProfile((ScanProfile) item.Tag!);
|
||||
toolbarItems.Add(item);
|
||||
}
|
||||
for (int i = 0; i < profiles.Count; i++)
|
||||
|
@ -143,7 +143,7 @@ public class OcrSetupForm : EtoDialogBase
|
||||
LoadLanguages();
|
||||
}
|
||||
|
||||
private void OcrLang_SelectedIndexChanged(object sender, EventArgs e)
|
||||
private void OcrLang_SelectedIndexChanged(object? sender, EventArgs e)
|
||||
{
|
||||
if (_suppressLangChangeEvent) return;
|
||||
if (_ocrLang.SelectedIndex == _ocrLang.Items.Count - 1)
|
||||
|
@ -236,10 +236,10 @@ internal class ScanPerformer : IScanPerformer
|
||||
: TwainTransferMode.Native,
|
||||
ShowProgress = scanProfile.TwainProgress,
|
||||
IncludeWiaDevices = false
|
||||
// TODO: Consider adding a user option for TwainOptions.ShowProgress instead of our progress window
|
||||
},
|
||||
SaneOptions =
|
||||
{
|
||||
// We use a worker process for SANE so we should clean up after each operation
|
||||
KeepInitialized = false
|
||||
},
|
||||
KeyValueOptions = scanProfile.KeyValueOptions != null
|
||||
|
@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">net8;net462</TargetFrameworks>
|
||||
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('Windows'))">net8-windows;net462</TargetFrameworks>
|
||||
<TargetFrameworks Condition="!$([MSBuild]::IsOSPlatform('Windows'))">net8</TargetFrameworks>
|
||||
<RootNamespace>NAPS2.Sdk.ScannerTests</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
@ -9,6 +9,9 @@ using Alphabet = NAPS2.Pdf.PdfFontPicker.Alphabet;
|
||||
|
||||
namespace NAPS2.Sdk.Tests.Pdf;
|
||||
|
||||
// As we use the same data for multiple methods, some parameters may be unused
|
||||
#pragma warning disable xUnit1026
|
||||
|
||||
public class PdfFontTests : ContextualTests
|
||||
{
|
||||
private readonly PdfImporter _importer;
|
||||
@ -36,7 +39,7 @@ public class PdfFontTests : ContextualTests
|
||||
|
||||
[Theory]
|
||||
[MemberData(nameof(AlphabetTestCases))]
|
||||
internal async Task MapLanguageCodeToAlphabet(Alphabet alphabet, string langCode, string text, bool rtl)
|
||||
internal void MapLanguageCodeToAlphabet(Alphabet alphabet, string langCode, string text, bool rtl)
|
||||
{
|
||||
Assert.Equal(alphabet, PdfFontPicker.MapLanguageCodeToAlphabet(langCode));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user