Skip to content

Commit

Permalink
* fix ReSharper warning PartialTypeWithSinglePart @ ExtensionMethod…
Browse files Browse the repository at this point in the history
…s.cs

* fix ReSharper warning `RedundantUsingDirective.Global` @ GlobalUsings.cs
@ crawler

* add `using Sdcb.PaddleOCR` @ GlobalUsings.cs
@ imagePipeline

+ GlobalUsings.cs
* using file scoped namespace @ ByteArrayEqualityComparer.cs
@ shared
@ c#
  • Loading branch information
n0099 committed May 2, 2024
1 parent b28fe96 commit 356fd44
Show file tree
Hide file tree
Showing 12 changed files with 18 additions and 30 deletions.
2 changes: 1 addition & 1 deletion c#/crawler/src/ExtensionMethods.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace tbm.Crawler;

public static partial class ExtensionMethods
public static class ExtensionMethods
{
/// <summary>
/// Returns a random long from min (inclusive) to max (exclusive)
Expand Down
1 change: 0 additions & 1 deletion c#/crawler/src/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
global using PostId = System.UInt64;
global using Tid = System.UInt64;
global using Pid = System.UInt64;
global using Spid = System.UInt64;
global using Time = System.UInt32;
global using Page = System.UInt32;
global using FailureCount = System.UInt16;
Expand Down
1 change: 1 addition & 0 deletions c#/imagePipeline/src/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
global using Polly;
global using Polly.Extensions.Http;
global using Polly.Registry;
global using Sdcb.PaddleOCR;
global using SixLabors.ImageSharp;
global using SixLabors.ImageSharp.Formats.Bmp;
global using SixLabors.ImageSharp.Formats.Gif;
Expand Down
1 change: 0 additions & 1 deletion c#/imagePipeline/src/Ocr/PaddleOcrProvider.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Sdcb.PaddleInference;
using Sdcb.PaddleOCR;
using Sdcb.PaddleOCR.Models.Online;
using static tbm.ImagePipeline.Ocr.PaddleOcrDetector;

Expand Down
2 changes: 0 additions & 2 deletions c#/imagePipeline/src/Ocr/PaddleOcrRecognizer.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using Sdcb.PaddleOCR;

namespace tbm.ImagePipeline.Ocr;

public class PaddleOcrRecognizer(PaddleOcrAll ocr)
Expand Down
4 changes: 0 additions & 4 deletions c#/shared/src/BaseEntryPoint.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
using Autofac;
using Autofac.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;
using NLog;
using NLog.Extensions.Logging;

namespace tbm.Shared;

Expand Down
21 changes: 10 additions & 11 deletions c#/shared/src/ByteArrayEqualityComparer.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
namespace tbm.Shared
namespace tbm.Shared;

public class ByteArrayEqualityComparer : EqualityComparer<byte[]>
{
public class ByteArrayEqualityComparer : EqualityComparer<byte[]>
{
public override bool Equals(byte[]? x, byte[]? y) =>
x == y || (x != null && y != null && x.AsSpan().SequenceEqual(y.AsSpan()));
public override bool Equals(byte[]? x, byte[]? y) =>
x == y || (x != null && y != null && x.AsSpan().SequenceEqual(y.AsSpan()));

public override int GetHashCode(byte[] obj)
{
var hash = default(HashCode);
hash.AddBytes(obj);
return hash.ToHashCode();
}
public override int GetHashCode(byte[] obj)
{
var hash = default(HashCode);
hash.AddBytes(obj);
return hash.ToHashCode();
}
}
3 changes: 0 additions & 3 deletions c#/shared/src/ErrorableWorker.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Logging;

namespace tbm.Shared;

#pragma warning disable AV1564 // Parameter in public or internal member is of type bool or bool?
Expand Down
2 changes: 0 additions & 2 deletions c#/shared/src/ExtensionMethods.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Reflection;
using Autofac;
using Microsoft.EntityFrameworkCore;

namespace tbm.Shared;

Expand Down
6 changes: 6 additions & 0 deletions c#/shared/src/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
global using Autofac;
global using Microsoft.EntityFrameworkCore;
global using Microsoft.Extensions.Hosting;
global using Microsoft.Extensions.Logging;
global using NLog.Extensions.Logging;
global using Npgsql;
1 change: 0 additions & 1 deletion c#/shared/src/NpgsqlCamelCaseNameTranslator.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Globalization;
using Npgsql;

namespace tbm.Shared;

Expand Down
4 changes: 0 additions & 4 deletions c#/shared/src/TbmDbContext.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
using System.Data;
using System.Data.Common;
using System.Diagnostics.CodeAnalysis;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Diagnostics;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using Npgsql;
using Npgsql.EntityFrameworkCore.PostgreSQL.Infrastructure;
using LogLevel = Microsoft.Extensions.Logging.LogLevel;

Expand Down

0 comments on commit 356fd44

Please sign in to comment.