From 042576b6a59db14ee024ddab6ee921aa38e8b3aa Mon Sep 17 00:00:00 2001
From: Cricle <15218450198@163.com>
Date: Sat, 17 Apr 2021 18:55:50 +0800
Subject: [PATCH 01/15] Create dotnet.yml
---
.github/workflows/dotnet.yml | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
create mode 100644 .github/workflows/dotnet.yml
diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
new file mode 100644
index 00000000..c38febf0
--- /dev/null
+++ b/.github/workflows/dotnet.yml
@@ -0,0 +1,25 @@
+name: .NET
+
+on:
+ push:
+ branches: [ dev ]
+ pull_request:
+ branches: [ dev ]
+
+jobs:
+ build:
+
+ runs-on: ubuntu-latest
+
+ steps:
+ - uses: actions/checkout@v2
+ - name: Setup .NET
+ uses: actions/setup-dotnet@v1
+ with:
+ dotnet-version: 5.0.x
+ - name: Restore dependencies
+ run: dotnet restore
+ - name: Build
+ run: dotnet build --no-restore
+ - name: Test
+ run: dotnet test --no-build --verbosity normal
From 5f9c4dd5cf8229bcd4012848c26f2d609d572803 Mon Sep 17 00:00:00 2001
From: Cricle <15218450198@163.com>
Date: Sat, 17 Apr 2021 18:58:33 +0800
Subject: [PATCH 02/15] Update dotnet.yml
---
.github/workflows/dotnet.yml | 2 ++
1 file changed, 2 insertions(+)
diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
index c38febf0..0c2308f1 100644
--- a/.github/workflows/dotnet.yml
+++ b/.github/workflows/dotnet.yml
@@ -17,6 +17,8 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
+ - name: Go folder
+ run: cd Platforms
- name: Restore dependencies
run: dotnet restore
- name: Build
From 0a24b9a89df9d440da3eb81c7569664062de5081 Mon Sep 17 00:00:00 2001
From: Cricle <15218450198@163.com>
Date: Sat, 17 Apr 2021 19:01:16 +0800
Subject: [PATCH 03/15] Update dotnet.yml
---
.github/workflows/dotnet.yml | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
index 0c2308f1..b1b69d9e 100644
--- a/.github/workflows/dotnet.yml
+++ b/.github/workflows/dotnet.yml
@@ -17,11 +17,9 @@ jobs:
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.x
- - name: Go folder
- run: cd Platforms
- name: Restore dependencies
- run: dotnet restore
+ run: dotnet restore Platforms\Anf.sln
- name: Build
- run: dotnet build --no-restore
+ run: dotnet build Platforms\Anf.sln --no-restore
- name: Test
- run: dotnet test --no-build --verbosity normal
+ run: dotnet test Platforms\Anf.sln --no-build --verbosity normal
From b398e3e44dbd25af5723b77c691a74cbb54c094a Mon Sep 17 00:00:00 2001
From: Cricle <15218450198@163.com>
Date: Sat, 17 Apr 2021 19:04:38 +0800
Subject: [PATCH 04/15] Update dotnet.yml
---
.github/workflows/dotnet.yml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
index b1b69d9e..86d6f8d0 100644
--- a/.github/workflows/dotnet.yml
+++ b/.github/workflows/dotnet.yml
@@ -18,8 +18,8 @@ jobs:
with:
dotnet-version: 5.0.x
- name: Restore dependencies
- run: dotnet restore Platforms\Anf.sln
+ run: dotnet restore Platforms/Anf.sln
- name: Build
- run: dotnet build Platforms\Anf.sln --no-restore
+ run: dotnet build Platforms/Anf.sln --no-restore
- name: Test
- run: dotnet test Platforms\Anf.sln --no-build --verbosity normal
+ run: dotnet test Platforms/Anf.sln --no-build --verbosity normal
From f00a4692bf32a5d4c8c73bc3337a19bc46034f47 Mon Sep 17 00:00:00 2001
From: Cricle <15218450198@163.com>
Date: Sat, 17 Apr 2021 19:05:59 +0800
Subject: [PATCH 05/15] Update dotnet.yml
---
.github/workflows/dotnet.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
index 86d6f8d0..2512bc5b 100644
--- a/.github/workflows/dotnet.yml
+++ b/.github/workflows/dotnet.yml
@@ -16,7 +16,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
- dotnet-version: 5.0.x
+ dotnet-version: 6.0.x
- name: Restore dependencies
run: dotnet restore Platforms/Anf.sln
- name: Build
From e5dec7a351a89b408c06572c2e80a9d570799ece Mon Sep 17 00:00:00 2001
From: Cricle <15218450198@163.com>
Date: Sat, 17 Apr 2021 19:13:53 +0800
Subject: [PATCH 06/15] Set up CI with Azure Pipelines
[skip ci]
---
azure-pipelines.yml | 33 +++++++++++++++++++++++++++++++++
1 file changed, 33 insertions(+)
create mode 100644 azure-pipelines.yml
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
new file mode 100644
index 00000000..ea4e9f28
--- /dev/null
+++ b/azure-pipelines.yml
@@ -0,0 +1,33 @@
+# .NET Desktop
+# Build and run tests for .NET Desktop or Windows classic desktop solutions.
+# Add steps that publish symbols, save build artifacts, and more:
+# https://docs.microsoft.com/azure/devops/pipelines/apps/windows/dot-net
+
+trigger:
+- dev
+
+pool:
+ vmImage: 'windows-latest'
+
+variables:
+ solution: '**/*.sln'
+ buildPlatform: 'Any CPU'
+ buildConfiguration: 'Release'
+
+steps:
+- task: NuGetToolInstaller@1
+
+- task: NuGetCommand@2
+ inputs:
+ restoreSolution: '$(solution)'
+
+- task: VSBuild@1
+ inputs:
+ solution: '$(solution)'
+ platform: '$(buildPlatform)'
+ configuration: '$(buildConfiguration)'
+
+- task: VSTest@2
+ inputs:
+ platform: '$(buildPlatform)'
+ configuration: '$(buildConfiguration)'
From 161c5d9db40a032c9f7c5f65918b0e71b8fcc33d Mon Sep 17 00:00:00 2001
From: "15218450198@163.com" <15218450198@163.com>
Date: Sat, 17 Apr 2021 19:17:13 +0800
Subject: [PATCH 07/15] move 6->5
---
Platforms/Anf.Avalon/Anf.Avalon.csproj | 2 +-
Platforms/Anf.Web/Anf.Web.csproj | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/Platforms/Anf.Avalon/Anf.Avalon.csproj b/Platforms/Anf.Avalon/Anf.Avalon.csproj
index 5622df18..3c2d405b 100644
--- a/Platforms/Anf.Avalon/Anf.Avalon.csproj
+++ b/Platforms/Anf.Avalon/Anf.Avalon.csproj
@@ -10,7 +10,7 @@
false
- net472;net6.0
+ net472;net5.0
net472
diff --git a/Platforms/Anf.Web/Anf.Web.csproj b/Platforms/Anf.Web/Anf.Web.csproj
index 8d994a0a..32ccc88d 100644
--- a/Platforms/Anf.Web/Anf.Web.csproj
+++ b/Platforms/Anf.Web/Anf.Web.csproj
@@ -2,7 +2,7 @@
Exe
- net6.0
+ net5.0
8.0
$(NoWarn);CS1591
false
From 962a717c39a9b0511ddb6128154ac84f37bc42a6 Mon Sep 17 00:00:00 2001
From: Cricle <15218450198@163.com>
Date: Sat, 17 Apr 2021 19:35:32 +0800
Subject: [PATCH 08/15] Update dotnet.yml
---
.github/workflows/dotnet.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/.github/workflows/dotnet.yml b/.github/workflows/dotnet.yml
index 2512bc5b..86d6f8d0 100644
--- a/.github/workflows/dotnet.yml
+++ b/.github/workflows/dotnet.yml
@@ -16,7 +16,7 @@ jobs:
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
- dotnet-version: 6.0.x
+ dotnet-version: 5.0.x
- name: Restore dependencies
run: dotnet restore Platforms/Anf.sln
- name: Build
From e5a635a1fea296009968eeaf813a4f36859325de Mon Sep 17 00:00:00 2001
From: "15218450198@163.com" <15218450198@163.com>
Date: Sat, 17 Apr 2021 19:46:53 +0800
Subject: [PATCH 09/15] fix test
---
test/Anf.Easy.Test/Visiting/BlockSlotsTest.cs | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/test/Anf.Easy.Test/Visiting/BlockSlotsTest.cs b/test/Anf.Easy.Test/Visiting/BlockSlotsTest.cs
index de0c869d..bdd7d41f 100644
--- a/test/Anf.Easy.Test/Visiting/BlockSlotsTest.cs
+++ b/test/Anf.Easy.Test/Visiting/BlockSlotsTest.cs
@@ -39,9 +39,10 @@ public async Task GivenDisposeableObject_Dispose_AllDisposed()
await slot.GetAsync(i);
}
slot.Dispose();
- for (int i = 0; i < slot.Size; i++)
+ var objs = slot.GetCreatedValues().OfType().ToArray();
+ for (int i = 0; i < objs.Length; i++)
{
- var obj = (DispoableObject)slot[i];
+ var obj = objs[i];
Assert.IsTrue(obj.IsDisposed);
}
}
From add4d2a1b2abaa3710c225d1bc811d5e66f02cd8 Mon Sep 17 00:00:00 2001
From: "15218450198@163.com" <15218450198@163.com>
Date: Sat, 17 Apr 2021 19:53:54 +0800
Subject: [PATCH 10/15] fix test
---
test/Anf.Easy.Test/Downloading/DownloadManagersTest.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/Anf.Easy.Test/Downloading/DownloadManagersTest.cs b/test/Anf.Easy.Test/Downloading/DownloadManagersTest.cs
index 566a6e97..34102822 100644
--- a/test/Anf.Easy.Test/Downloading/DownloadManagersTest.cs
+++ b/test/Anf.Easy.Test/Downloading/DownloadManagersTest.cs
@@ -22,7 +22,7 @@ private async Task Run(AsyncDownloadManager mgr,int taskCount,int preCount)
}
mgr.Start();
var tks = new CancellationTokenSource();
- var timeOutTask = Task.Delay(10 * 1000).ContinueWith(_ => tks.Cancel());
+ var timeOutTask = Task.Delay(TimeSpan.FromMinutes(30)).ContinueWith(_ => tks.Cancel());
while (!tks.IsCancellationRequested)
{
if (mgr.Count == 0)
From 8915fb151f7de1372248a982a90429dfa5678ffd Mon Sep 17 00:00:00 2001
From: Cricle <15218450198@163.com>
Date: Sat, 17 Apr 2021 20:07:04 +0800
Subject: [PATCH 11/15] Update azure-pipelines.yml for Azure Pipelines
---
azure-pipelines.yml | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index ea4e9f28..a668bfa9 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -31,3 +31,16 @@ steps:
inputs:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
+
+- script: 'dotnet tool install --global dotnet-reportgenerator-globaltool --version 4.5.8'
+ displayName: 'Install ReportGenerator tool'
+
+- script: 'reportgenerator -reports:$(Agent.TempDirectory)/**/coverage.cobertura.xml -targetdir:$(Build.SourcesDirectory)/coverlet/reports -reporttypes:"Cobertura"'
+ displayName: 'Create reports'
+
+- task: PublishCodeCoverageResults@1
+ displayName: 'Publish code coverage'
+ inputs:
+ codeCoverageTool: Cobertura
+ summaryFileLocation: '$(Build.SourcesDirectory)/coverlet/reports/Cobertura.xml'
+
From 62d41b1feca0e0bfe36cdc9e1a8385ea061446ff Mon Sep 17 00:00:00 2001
From: "15218450198@163.com" <15218450198@163.com>
Date: Sat, 17 Apr 2021 20:11:53 +0800
Subject: [PATCH 12/15] gix test
---
test/Anf.Easy.Test/ComicHostExtensionsTest.cs | 4 ++--
test/Anf.Easy.Test/Visiting/ComicVisitingHelper.cs | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/test/Anf.Easy.Test/ComicHostExtensionsTest.cs b/test/Anf.Easy.Test/ComicHostExtensionsTest.cs
index 0c092832..417d0911 100644
--- a/test/Anf.Easy.Test/ComicHostExtensionsTest.cs
+++ b/test/Anf.Easy.Test/ComicHostExtensionsTest.cs
@@ -30,7 +30,7 @@ public async Task GetVisitingAndLoadAsync_MustReturnLoadedVisitor()
[typeof(IComicVisiting)]=()=>ComicVisitingHelper.CreateResrouceVisitor()
}
};
- var visitor=await ComicHostExtensions.GetVisitingAndLoadAsync(provider, "http://localhost:8765");
+ var visitor=await ComicHostExtensions.GetVisitingAndLoadAsync(provider, "http://localhost:8887");
Assert.IsNotNull(visitor);
Assert.IsNotNull(visitor.Entity);
}
@@ -44,7 +44,7 @@ public async Task GetVisitingAndLoadAsync_FailToLoad_MustReturnNull()
[typeof(IComicVisiting)] = () => new NullComicVisiting { LoadSucceed=false}
}
};
- var visitor = await ComicHostExtensions.GetVisitingAndLoadAsync(provider, "http://localhost:8765");
+ var visitor = await ComicHostExtensions.GetVisitingAndLoadAsync(provider, "http://localhost:8889");
Assert.IsNull(visitor);
}
[TestMethod]
diff --git a/test/Anf.Easy.Test/Visiting/ComicVisitingHelper.cs b/test/Anf.Easy.Test/Visiting/ComicVisitingHelper.cs
index 4c1010e0..bbfc5823 100644
--- a/test/Anf.Easy.Test/Visiting/ComicVisitingHelper.cs
+++ b/test/Anf.Easy.Test/Visiting/ComicVisitingHelper.cs
@@ -9,7 +9,7 @@ namespace Anf.Easy.Test.Visiting
{
internal static class ComicVisitingHelper
{
- public static readonly Uri AnyUri = new Uri("http://localhost:8765/");
+ public static readonly Uri AnyUri = new Uri("http://localhost:8886/");
public static ComicVisiting CreateResrouceVisitor()
{
var creator = new StreamResourceFactoryCreator();
From e031985e6bc87e1da7fcddff251ced55406910b2 Mon Sep 17 00:00:00 2001
From: Cricle <15218450198@163.com>
Date: Sat, 17 Apr 2021 20:22:19 +0800
Subject: [PATCH 13/15] Update azure-pipelines.yml for Azure Pipelines
---
azure-pipelines.yml | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index a668bfa9..3123672c 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -32,6 +32,14 @@ steps:
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
+- task: DotNetCoreCLI@2
+ displayName: 'dotnet test'
+ inputs:
+ command: test
+ projects: '**/*.Test.csproj'
+ arguments: '--configuration $(BuildConfiguration) --collect "XPlat Code coverage" -- RunConfiguration.DisableAppDomain=true'
+ testRunTitle: MyProject.UnitTests
+
- script: 'dotnet tool install --global dotnet-reportgenerator-globaltool --version 4.5.8'
displayName: 'Install ReportGenerator tool'
From 801d4ff2d0e990d6c7486fc5d1192d78cdb43feb Mon Sep 17 00:00:00 2001
From: "15218450198@163.com" <15218450198@163.com>
Date: Sat, 17 Apr 2021 21:42:34 +0800
Subject: [PATCH 14/15] add eng
---
Platforms/Anf.Avalon/App.axaml.cs | 6 +-
Platforms/Anf.Avalon/MainWindow.axaml | 55 +++---
.../ViewModels/AvalonVisitingViewModel.cs | 5 +
.../Anf.Avalon/Views/VisitingView.axaml.cs | 1 +
.../Anf.KnowEngines/BilibiliComicOperator.cs | 4 +
.../Anf.KnowEngines/KnowEnginesExtensions.cs | 4 +
.../Anf.KnowEngines/MangabzComicCondition.cs | 16 ++
.../Anf.KnowEngines/MangabzComicOperator.cs | 164 ++++++++++++++++++
.../Anf.KnowEngines/XmanhuaComicCondition.cs | 16 ++
.../Anf.KnowEngines/XmanhuaComicOperator.cs | 17 ++
test/Anf.Easy.Test/Anf.Easy.Test.csproj | 1 +
11 files changed, 259 insertions(+), 30 deletions(-)
create mode 100644 Platforms/Engines/Anf.KnowEngines/MangabzComicCondition.cs
create mode 100644 Platforms/Engines/Anf.KnowEngines/MangabzComicOperator.cs
create mode 100644 Platforms/Engines/Anf.KnowEngines/XmanhuaComicCondition.cs
create mode 100644 Platforms/Engines/Anf.KnowEngines/XmanhuaComicOperator.cs
diff --git a/Platforms/Anf.Avalon/App.axaml.cs b/Platforms/Anf.Avalon/App.axaml.cs
index 0e1e9448..0a6d8824 100644
--- a/Platforms/Anf.Avalon/App.axaml.cs
+++ b/Platforms/Anf.Avalon/App.axaml.cs
@@ -51,7 +51,7 @@ private void CurrentDomain_UnhandledException(object sender, UnhandledExceptionE
private void InitServices()
{
AppEngine.Reset();
- AppEngine.AddServices(NetworkAdapterTypes.WebRequest);
+ AppEngine.AddServices(NetworkAdapterTypes.HttpClient);
var store = FileStoreService.FromMd5Default(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, XComicConst.CacheFolderName));
var hp = new Lazy(() => new HomePage());
var cv = new Lazy(() => new ComicView());
@@ -90,8 +90,8 @@ public override void OnFrameworkInitializationCompleted()
var nav = AppEngine.GetRequiredService();
var mainWin = AppEngine.GetRequiredService();
desktop.MainWindow =mainWin;
- nav.Navigate(new VisitingView());
- //nav.Navigate();
+ //nav.Navigate(new VisitingView());
+ nav.Navigate();
AppEngine.GetRequiredService().Bind(mainWin);
mainWin.KeyDown += OnMainWinKeyDown;
diff --git a/Platforms/Anf.Avalon/MainWindow.axaml b/Platforms/Anf.Avalon/MainWindow.axaml
index 178f5528..9f9efe72 100644
--- a/Platforms/Anf.Avalon/MainWindow.axaml
+++ b/Platforms/Anf.Avalon/MainWindow.axaml
@@ -9,33 +9,35 @@
x:Class="Anf.Avalon.MainWindow"
Title="Anf">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ IsVisible="{Binding HasException}"
+ VerticalAlignment="Stretch"
+ HorizontalAlignment="Stretch"
+ Padding="16">
@@ -65,6 +67,5 @@
-
diff --git a/Platforms/Anf.Avalon/ViewModels/AvalonVisitingViewModel.cs b/Platforms/Anf.Avalon/ViewModels/AvalonVisitingViewModel.cs
index 8bf66c3a..33b7332d 100644
--- a/Platforms/Anf.Avalon/ViewModels/AvalonVisitingViewModel.cs
+++ b/Platforms/Anf.Avalon/ViewModels/AvalonVisitingViewModel.cs
@@ -211,5 +211,10 @@ protected async override void OnCurrentChaterCursorChanged(IDataCursor();
services.AddScoped();
services.AddScoped();
+ services.AddScoped();
+ services.AddScoped();
}
public static void UseKnowEngines(this IServiceProvider provider)
{
@@ -29,6 +31,8 @@ public static void UseKnowEngines(this IServiceProvider provider)
eng.Add(new TencentComicSourceCondition());
eng.Add(new BilibiliComicSourceCondition());
eng.Add(new QimianComicSourceCondition());
+ eng.Add(new MangabzComicCondition());
+ eng.Add(new XmanhuaComicCondition());
var searchEng = provider.GetRequiredService();
searchEng.Add(typeof(SomanSearchProvider));
}
diff --git a/Platforms/Engines/Anf.KnowEngines/MangabzComicCondition.cs b/Platforms/Engines/Anf.KnowEngines/MangabzComicCondition.cs
new file mode 100644
index 00000000..f156f0fe
--- /dev/null
+++ b/Platforms/Engines/Anf.KnowEngines/MangabzComicCondition.cs
@@ -0,0 +1,16 @@
+using System;
+
+namespace Anf.KnowEngines
+{
+ public class MangabzComicCondition : ComicSourceConditionBase
+ {
+ public override string EnginName => "Mangabz";
+
+ public override Uri Address { get; } = new Uri("http://www.mangabz.com/");
+
+ public override bool Condition(ComicSourceContext context)
+ {
+ return context.Uri.Host == Address.Host;
+ }
+ }
+}
diff --git a/Platforms/Engines/Anf.KnowEngines/MangabzComicOperator.cs b/Platforms/Engines/Anf.KnowEngines/MangabzComicOperator.cs
new file mode 100644
index 00000000..ced93c22
--- /dev/null
+++ b/Platforms/Engines/Anf.KnowEngines/MangabzComicOperator.cs
@@ -0,0 +1,164 @@
+using Anf.Networks;
+using HtmlAgilityPack;
+using JavaScriptEngineSwitcher.Core;
+using Jint.Native.Array;
+using Newtonsoft.Json.Linq;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Text.RegularExpressions;
+using System.Threading.Tasks;
+
+namespace Anf.KnowEngines
+{
+ public class MangabzComicOperator : IComicSourceProvider
+ {
+ private static readonly Regex cidRegex = new Regex(@"var MANGABZ_CID=(.*)?;", RegexOptions.Compiled);
+ private static readonly Regex dtRegex = new Regex(@"var MANGABZ_VIEWSIGN_DT=""(.*)?"";", RegexOptions.Compiled);
+ private static readonly Regex midRegex = new Regex(@"var MANGABZ_MID=(.*)?;", RegexOptions.Compiled);
+ private static readonly Regex viewSignRegex = new Regex(@"var MANGABZ_VIEWSIGN=(.*)?;", RegexOptions.Compiled);
+ private static readonly Regex imageCountRegex = new Regex(@"var MANGABZ_IMAGE_COUNT=(.*)?;", RegexOptions.Compiled);
+
+ private readonly INetworkAdapter networkAdapter;
+ private readonly IJsEngine jsEngine;
+ private static readonly Dictionary headers = new Dictionary
+ {
+ ["User-Agent"] = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4437.0 Safari/537.36 Edg/91.0.831.1",
+ };
+
+ public MangabzComicOperator(INetworkAdapter networkAdapter, IJsEngine jsEngine)
+ {
+ this.networkAdapter = networkAdapter;
+ this.jsEngine = jsEngine;
+ }
+
+ protected virtual Task GetStreamAsync(string address)
+ {
+ return networkAdapter.GetStreamAsync(new RequestSettings
+ {
+ Address = address,
+ Host = new Uri(address).Host,
+ Referrer = GetBaseAddress(),
+ Headers = headers
+ });
+ }
+ protected virtual string GetBaseAddress()
+ {
+ return "http://www.mangabz.com/";
+ }
+ public async Task GetChaptersAsync(string targetUrl)
+ {
+ var str = string.Empty;
+ using (var sr = new StreamReader(await GetStreamAsync(targetUrl)))
+ {
+ str = sr.ReadToEnd();
+ }
+ var html = new HtmlDocument();
+ html.LoadHtml(str);
+ var img = html.DocumentNode.SelectSingleNode("//div[@class='detail-info']/img[@class='detail-info-cover']");
+ var title = html.DocumentNode.SelectSingleNode("//div[@class='detail-info']/p[@class='detail-info-title']");
+ var desc = html.DocumentNode.SelectSingleNode("//div[@class='detail-info']/div[@class='detail-info-content']");
+
+ var chpsBox = html.DocumentNode.SelectNodes("//div[@id='chapterlistload']/a");
+ var chps = new List();
+ foreach (var item in chpsBox)
+ {
+ var name = item.InnerText.Replace(" ", string.Empty);
+ var addr = item.Attributes["href"].Value;
+ var chp = new ComicChapter
+ {
+ Title = name,
+ TargetUrl = "http://www.mangabz.com" + addr
+ };
+ chps.Add(chp);
+ }
+ var entity = new ComicEntity
+ {
+ ComicUrl = targetUrl,
+ Descript = desc?.InnerText,
+ ImageUrl = img?.Attributes["src"].Value,
+ Name = title?.InnerText,
+ Chapters = chps.ToArray()
+ };
+ return entity;
+ }
+
+ public Task GetImageStreamAsync(string targetUrl)
+ {
+ return GetStreamAsync(targetUrl);
+ }
+
+ public async Task GetPagesAsync(string targetUrl)
+ {
+ var str = string.Empty;
+ using (var sr = new StreamReader(await GetStreamAsync(targetUrl)))
+ {
+ str = sr.ReadToEnd();
+ }
+ var cidRgx = cidRegex.Match(str).Groups[0].Value;
+ var dtRgx = dtRegex.Match(str).Groups[0].Value;
+ var midRgx = midRegex.Match(str).Groups[0].Value;
+ var viewSignRgx = viewSignRegex.Match(str).Groups[0].Value;
+ var imgCountRgx = imageCountRegex.Match(str).Groups[0].Value;
+
+ var cid = cidRgx.Substring(0, cidRgx.IndexOf(';')).Split('=').Last();
+ var dt = dtRgx.Substring(0, dtRgx.IndexOf(';')).Split('=').Last().Trim('\"');
+ var mid = midRgx.Substring(0, midRgx.IndexOf(';')).Split('=').Last();
+ var viewSign = viewSignRgx.Substring(0, viewSignRgx.IndexOf(';')).Split('=').Last().Trim('\"');
+ var imgCount = imgCountRgx.Substring(0, imgCountRgx.IndexOf(';')).Split('=').Last().Trim('\"');
+ var val = int.Parse(imgCount);
+
+ var refAddr = new Uri(targetUrl).Segments.Last();
+
+ var part = $"{GetBaseAddress()}/{refAddr}/chapterimage.ashx?cid={cid}&page={{0}}&key=&_cid={cid}&_mid={mid}&_dt={DateTime.Now}&_sign={viewSign}";
+
+ async Task RunBlockAsync(int index)
+ {
+ var pgs = new List();
+ var partBlock = string.Format(part, index + 1);
+
+ string partEncod = null;
+ using (var sr = new StreamReader(await GetStreamAsync(partBlock)))
+ {
+ partEncod = sr.ReadToEnd();
+ }
+ if (!string.IsNullOrEmpty(partEncod))
+ {
+ var ret = (ArrayInstance)jsEngine.Evaluate(partEncod);
+ var length = ret.GetLength();
+ for (int i = 0; i < length; i++)
+ {
+ pgs.Add(new ComicPage
+ {
+ Name = (index + 1).ToString(),
+ TargetUrl = ret.GetProperty(i.ToString()).Value.ToString()
+ });
+ }
+ }
+ return pgs.ToArray();
+ }
+ var datas = new List();
+ for (int i = 0; i < val; i++)
+ {
+ var j = i;
+ datas.Add(await RunBlockAsync(j));
+ }
+ var containPages = new HashSet();
+ var pages = new List(datas.Count);
+ for (int i = 0; i < datas.Count; i++)
+ {
+ var res = datas[i];
+ for (int q = 0; q < res.Length; q++)
+ {
+ var r = res[q];
+ if (containPages.Add(r.TargetUrl))
+ {
+ pages.Add(r);
+ }
+ }
+ }
+ return pages.ToArray();
+ }
+ }
+}
diff --git a/Platforms/Engines/Anf.KnowEngines/XmanhuaComicCondition.cs b/Platforms/Engines/Anf.KnowEngines/XmanhuaComicCondition.cs
new file mode 100644
index 00000000..30f16d1e
--- /dev/null
+++ b/Platforms/Engines/Anf.KnowEngines/XmanhuaComicCondition.cs
@@ -0,0 +1,16 @@
+using System;
+
+namespace Anf.KnowEngines
+{
+ public class XmanhuaComicCondition : ComicSourceConditionBase
+ {
+ public override string EnginName => "Xmanhua";
+
+ public override Uri Address { get; } = new Uri("http://www.xmanhua.com/");
+
+ public override bool Condition(ComicSourceContext context)
+ {
+ return context.Uri.Host == Address.Host;
+ }
+ }
+}
diff --git a/Platforms/Engines/Anf.KnowEngines/XmanhuaComicOperator.cs b/Platforms/Engines/Anf.KnowEngines/XmanhuaComicOperator.cs
new file mode 100644
index 00000000..aaa9d1fd
--- /dev/null
+++ b/Platforms/Engines/Anf.KnowEngines/XmanhuaComicOperator.cs
@@ -0,0 +1,17 @@
+using Anf.Networks;
+using JavaScriptEngineSwitcher.Core;
+
+namespace Anf.KnowEngines
+{
+ public class XmanhuaComicOperator : MangabzComicOperator
+ {
+ public XmanhuaComicOperator(INetworkAdapter networkAdapter, IJsEngine jsEngine) : base(networkAdapter, jsEngine)
+ {
+ }
+
+ protected override string GetBaseAddress()
+ {
+ return "http://www.xmanhua.com";
+ }
+ }
+}
diff --git a/test/Anf.Easy.Test/Anf.Easy.Test.csproj b/test/Anf.Easy.Test/Anf.Easy.Test.csproj
index 38afeb6b..311620a1 100644
--- a/test/Anf.Easy.Test/Anf.Easy.Test.csproj
+++ b/test/Anf.Easy.Test/Anf.Easy.Test.csproj
@@ -6,6 +6,7 @@
+
From 3edfcfade3b62b24829576ecc8704b3cdfafe867 Mon Sep 17 00:00:00 2001
From: "dependabot-preview[bot]"
<27856297+dependabot-preview[bot]@users.noreply.github.com>
Date: Sun, 18 Apr 2021 11:48:00 +0000
Subject: [PATCH 15/15] Bump Microsoft.Extensions.DependencyInjection in
/Platforms
Bumps [Microsoft.Extensions.DependencyInjection](https://github.com/dotnet/runtime) from 5.0.0 to 5.0.1.
- [Release notes](https://github.com/dotnet/runtime/releases)
- [Commits](https://github.com/dotnet/runtime/compare/v5.0.0...v5.0.1)
Signed-off-by: dependabot-preview[bot]
---
Platforms/Anf.Engine.Easy/Anf.Easy.csproj | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/Platforms/Anf.Engine.Easy/Anf.Easy.csproj b/Platforms/Anf.Engine.Easy/Anf.Easy.csproj
index cfc2c856..560939fa 100644
--- a/Platforms/Anf.Engine.Easy/Anf.Easy.csproj
+++ b/Platforms/Anf.Engine.Easy/Anf.Easy.csproj
@@ -16,12 +16,12 @@
-
+
-
+