Skip to content

Commit a245c10

Browse files
committed
Testing
1 parent eeef5e4 commit a245c10

File tree

15 files changed

+80
-26
lines changed

15 files changed

+80
-26
lines changed

SmartImage 3/Mode/Shell/Assets/UI.Styles.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// 2023-02-14 @ 12:12 AM
33

44
#region
5-
5+
using Color = Terminal.Gui.Color;
66
using System.Runtime.Caching;
77
using AngleSharp.Dom;
88
using Terminal.Gui;

SmartImage 3/Mode/Shell/Assets/UI.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
using SmartImage.Lib.Engines;
1313
using Terminal.Gui;
1414
using Attribute = Terminal.Gui.Attribute;
15-
15+
using Color=Terminal.Gui.Color;
1616
#endregion
1717

1818
// ReSharper disable InconsistentNaming

SmartImage 3/Mode/Shell/ShellMode.Handlers.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Read S SmartImage ShellMode.Handlers.cs
22
// 2023-02-14 @ 12:13 AM
33

4+
using Color = Terminal.Gui.Color;
45
using System.Collections;
56
using System.Collections.Concurrent;
67
using System.Data;
@@ -31,8 +32,9 @@ namespace SmartImage.Mode.Shell;
3132

3233
public sealed partial class ShellMode
3334
{
34-
private const int INDEX = 1;
35-
private const int INV = -1;
35+
private const int INDEX = 1;
36+
private const int INV = -1;
37+
3638
private static readonly ConcurrentDictionary<object, ustring> Message = new();
3739

3840
/// <summary>
@@ -117,7 +119,7 @@ private void Restart_Clicked(bool force = false)
117119
Tf_Input.EnsureFocus();
118120

119121
_keyPressHandling = false;
120-
_inputVerifying = false;
122+
_inputVerifying = false;
121123
}
122124

123125
/// <summary>

SmartImage 3/Program.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
#region
77

8+
global using IColor = SixLabors.ImageSharp.Color;
9+
global using IImage = SixLabors.ImageSharp.Image;
810
global using static Kantan.Diagnostics.LogCategories;
911
using System.CommandLine;
1012
using System.ComponentModel;
@@ -139,5 +141,7 @@ public static async Task<int> Main(string[] args)
139141

140142
return ConsoleUtil.CODE_OK;
141143
}
144+
142145
}
146+
143147
}

SmartImage 3/SmartImage.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@
7373
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.1" />
7474
<PackageReference Include="Microsoft.Extensions.Options.ConfigurationExtensions" Version="7.0.0" />
7575
<PackageReference Include="Microsoft.NETCore.Platforms" Version="7.0.2" />
76+
<PackageReference Include="SixLabors.ImageSharp" Version="3.0.1" />
7677
<PackageReference Include="Spectre.Console" Version="0.47.0" />
7778
<PackageReference Include="Spectre.Console.Analyzer" Version="0.47.0">
7879
<PrivateAssets>all</PrivateAssets>

SmartImage.Lib 3/Engines/BaseSearchEngine.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
global using Url = Flurl.Url;
2+
using Image = System.Drawing.Image;
23
using System.Diagnostics;
34
using System.Drawing;
45
using System.Json;
@@ -80,7 +81,8 @@ public virtual async Task<SearchResult> GetResultAsync(SearchQuery query, Cancel
8081
var res = new SearchResult(this)
8182
{
8283
RawUrl = await GetRawUrlAsync(query),
83-
Status = !b ? SearchResultStatus.IllegalInput : SearchResultStatus.None
84+
Status = !b ? SearchResultStatus.IllegalInput : SearchResultStatus.None,
85+
ErrorMessage = $"Engine restriction"
8486
};
8587

8688
Debug.WriteLine($"{query} - {res.Status}", nameof(GetResultAsync));

SmartImage.Lib 3/Engines/Impl/Search/Ascii2DEngine.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
using Flurl.Http;
88
using Kantan.Net.Utilities;
99
using SmartImage.Lib.Results;
10-
10+
using Image=System.Drawing.Image;
1111
// ReSharper disable CognitiveComplexity
1212

1313
// ReSharper disable IdentifierTypo
@@ -27,7 +27,7 @@ public Ascii2DEngine() : base("https://ascii2d.net/search/url/")
2727

2828
protected override string NodesSelector => Serialization.S_Ascii2D_Images;
2929

30-
public override SearchEngineOptions EngineOption => SearchEngineOptions.Ascii2D;
30+
public override SearchEngineOptions EngineOption => SearchEngineOptions.Ascii2D;
3131

3232
protected override bool VerifyImage(Image i)
3333
{

SmartImage.Lib 3/Engines/Impl/Upload/BaseUploadEngine.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System.Diagnostics;
22
using System.Net.NetworkInformation;
3+
using System.Reflection.PortableExecutable;
34
using Flurl.Http;
45
using Novus.OS;
56
using Novus.Utilities;
@@ -12,7 +13,7 @@ public abstract class BaseUploadEngine : IEndpoint
1213
/// <summary>
1314
/// Max file size, in bytes
1415
/// </summary>
15-
public abstract int MaxSize { get; }
16+
public abstract long MaxSize { get; }
1617

1718
public abstract string Name { get; }
1819

@@ -78,6 +79,7 @@ public override async Task<BaseUploadResponse> UploadFileAsync(string file, Canc
7879
protected override async Task<BaseUploadResponse> VerifyResultAsync(
7980
IFlurlResponse response, CancellationToken ct = default)
8081
{
82+
8183
var responseMessage = response.ResponseMessage;
8284

8385
var url = await responseMessage.Content.ReadAsStringAsync(ct);
@@ -87,10 +89,8 @@ protected override async Task<BaseUploadResponse> VerifyResultAsync(
8789
if (Paranoid) {
8890
var r2 = await url.GetAsync(ct);
8991

90-
if (r2.Headers.TryGetFirst("Content-Length", out var cls)) {
91-
if (int.Parse(cls) == 0) {
92-
ok = false;
93-
}
92+
if (NetHelper.GetContentLength(r2) == 0) {
93+
ok = false;
9494
}
9595

9696
}

SmartImage.Lib 3/Engines/Impl/Upload/CatboxEngine.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ public sealed class CatboxEngine : BaseCatboxEngine
77

88
public override string Name => "Catbox";
99

10-
public override int MaxSize => 1 * 1000 * 1000 * 200;
10+
public override long MaxSize => 1 * 1000 * 1000 * 200;
1111

1212
public CatboxEngine() : base("https://catbox.moe/user/api.php")
1313
{

SmartImage.Lib 3/Engines/Impl/Upload/LitterboxEngine.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ public sealed class LitterboxEngine : BaseCatboxEngine
1010
{
1111
public override string Name => "Litterbox";
1212

13-
public override int MaxSize => 1 * 1000 * 1000 * 1000;
13+
public override long MaxSize => 1 * 1000 * 1000 * 1000;
1414

1515
public LitterboxEngine() : base("https://litterbox.catbox.moe/resources/internals/api.php") { }
1616
}

0 commit comments

Comments
 (0)