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