diff --git a/MoeLoaderP.Core/DownloadItem.cs b/MoeLoaderP.Core/DownloadItem.cs index e0616eb..5659f6a 100644 --- a/MoeLoaderP.Core/DownloadItem.cs +++ b/MoeLoaderP.Core/DownloadItem.cs @@ -225,7 +225,7 @@ public async Task DownloadSingleFileAsync(CancellationToken token) { try { - await durl.AfterEffects.Invoke(this, data.Content, token); + await durl.AfterEffects.Invoke(this, token); } catch (Exception e) { diff --git a/MoeLoaderP.Core/MoeItem.cs b/MoeLoaderP.Core/MoeItem.cs index 2b40da3..4b8d0cf 100644 --- a/MoeLoaderP.Core/MoeItem.cs +++ b/MoeLoaderP.Core/MoeItem.cs @@ -243,7 +243,7 @@ public class TextFileInfo public string Content { get; set; } } - public delegate Task AfterEffectsDelegate(DownloadItem item,HttpContent content, CancellationToken token); + public delegate Task AfterEffectsDelegate(DownloadItem item, CancellationToken token); public delegate Task ResolveUrlDelegate(DownloadItem item, CancellationToken token); diff --git a/MoeLoaderP.Core/MoeLoaderP.Core.csproj b/MoeLoaderP.Core/MoeLoaderP.Core.csproj index ce8ac00..275ab00 100644 --- a/MoeLoaderP.Core/MoeLoaderP.Core.csproj +++ b/MoeLoaderP.Core/MoeLoaderP.Core.csproj @@ -5,10 +5,11 @@ - - + + - + + diff --git a/MoeLoaderP.Core/Settings.cs b/MoeLoaderP.Core/Settings.cs index 9a030bb..699d5c3 100644 --- a/MoeLoaderP.Core/Settings.cs +++ b/MoeLoaderP.Core/Settings.cs @@ -258,15 +258,19 @@ public class AllMoeSitesSettings : Dictionary { } public class SingleMoeSiteSettings : BindingObject { private string _loginCookie; + private Dictionary _otherSettings; public string LoginCookie { get => _loginCookie; set => SetField(ref _loginCookie, value, nameof(LoginCookie)); } - - public string LoginUserName { get; set; } - public string LoginUserId { get; set; } + + public Dictionary OtherSettings + { + get => _otherSettings; + set => SetField(ref _otherSettings, value, nameof(OtherSettings)); + } } public class AllCustomSitesSettings : Dictionary { } diff --git a/MoeLoaderP.Core/Sites/CustomSiteFactory.cs b/MoeLoaderP.Core/Sites/CustomSiteFactory.cs deleted file mode 100644 index 832f751..0000000 --- a/MoeLoaderP.Core/Sites/CustomSiteFactory.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace MoeLoaderP.Core.Sites -{ - public class CustomSiteFactory - { - - } -} diff --git a/MoeLoaderP.Core/Sites/MoeSite.cs b/MoeLoaderP.Core/Sites/MoeSite.cs index 88492a1..5e9a07f 100644 --- a/MoeLoaderP.Core/Sites/MoeSite.cs +++ b/MoeLoaderP.Core/Sites/MoeSite.cs @@ -149,6 +149,8 @@ public class MoeSiteSupportState public bool IsSupportThumbButton { get; set; } = false; public bool IsSupportStarButton { get; set; } = false; + + public bool IsSupportMultiKeywords { get; set; } = false; } diff --git a/MoeLoaderP.Core/Sites/PixivSite.cs b/MoeLoaderP.Core/Sites/PixivSite.cs index b84a994..5e01ded 100644 --- a/MoeLoaderP.Core/Sites/PixivSite.cs +++ b/MoeLoaderP.Core/Sites/PixivSite.cs @@ -382,7 +382,7 @@ public async Task GetUgoiraDetailPageTask(MoeItem img) } } - private async Task UgoiraAfterEffects(DownloadItem item, HttpContent content, CancellationToken token) + private async Task UgoiraAfterEffects(DownloadItem item, CancellationToken token) { // save json var path = Path.ChangeExtension(item.LocalFileFullPath, item.DownloadMoeItem.ExtraFile.FileExt); @@ -404,20 +404,21 @@ private async Task UgoiraAfterEffects(DownloadItem item, HttpContent content, Ca var gifPath = Path.ChangeExtension(item.LocalFileFullPath, "gif"); if (gifPath == null) return; var fi = new FileInfo(gifPath); - using (var stream = await content.ReadAsStreamAsync()) + using (var stream = new FileStream(item.LocalFileFullPath, FileMode.Open)) { item.StatusText = "正在转换为GIF.."; await Task.Run(() => { // ConvertPixivZipToGif var delayList = new List(); + using (var images = new MagickImageCollection()) { foreach (var frame in list) { delayList.Add($"{frame.delay}".ToInt()); } - using (var zip = new ZipArchive(stream, ZipArchiveMode.Read)) + using (var zip = new ZipArchive(stream, ZipArchiveMode.Read)) //todo 失败 { for (var i = 0; i < zip.Entries.Count; i++) { diff --git a/MoeLoaderP.Core/Sites/SankakuChanSite.cs b/MoeLoaderP.Core/Sites/SankakuChanSite.cs index 8703369..3657978 100644 --- a/MoeLoaderP.Core/Sites/SankakuChanSite.cs +++ b/MoeLoaderP.Core/Sites/SankakuChanSite.cs @@ -19,7 +19,7 @@ public SankakuChanSite() { DownloadTypes.Add("原图", 4); LoginPageUrl = "https://beta.sankakucomplex.com/home"; - SupportState.IsSupportAccount = true; + SupportState.IsSupportAccount = false; SupportState.IsSupportStarButton = true; } @@ -69,7 +69,7 @@ public override async Task GetRealPageImagesAsync(SearchPara para, Can } else { - Net.CloneWithOldCookie(); + Net = Net.CloneWithOldCookie(); } Net.SetReferer(beta); diff --git a/MoeLoaderP.Core/Sites/YuriimgSite.cs b/MoeLoaderP.Core/Sites/YuriimgSite.cs index f547a3f..d2de60c 100644 --- a/MoeLoaderP.Core/Sites/YuriimgSite.cs +++ b/MoeLoaderP.Core/Sites/YuriimgSite.cs @@ -1,5 +1,7 @@ -using System.Threading; +using System.Text; +using System.Threading; using System.Threading.Tasks; +using Newtonsoft.Json.Linq; namespace MoeLoaderP.Core.Sites { @@ -10,16 +12,43 @@ public class YuriimgSite : MoeSite { public override string HomeUrl => "http://yuriimg.com"; public override string ShortName => "yuriimg"; - public override string DisplayName => "Yuriimg(百合居)"; + public override string DisplayName => "Yuriimg"; public YuriimgSite() { SupportState.IsSupportAutoHint = false; SupportState.IsSupportRating = true; + DownloadTypes.Add("预览图", 3); DownloadTypes.Add("原图", 4); } + /// + /// 图片地址拼接 图片类型 0缩略图 1预览图 2原图 + /// + private string TranslateImageUrl(dynamic json, int type = 0) + { + var fileExt = $"{json.file_ext}"; + var sb = new StringBuilder(); + sb.Append($"https://i.yuriimg.com/{json.src}/"); + sb.Append("yuriimg.com "); + sb.Append($"{json.id} "); + if (!fileExt.IsEmpty()) + { + switch (type) + { + case 1: sb.Append("thumb"); break; + case 2: sb.Append($"{fileExt}"); break; + default: sb.Append("contain"); break; + } + } + else { sb.Append("contain"); } + + sb.Append($"{(json.page == null ? string.Empty : $" p{$"{json.page}".ToInt() + 1}")}"); + sb.Append($".{(fileExt.IsEmpty() ? "webp" : fileExt)}"); + return sb.ToString(); + } + public async Task GetDetailTask(MoeItem img, string id, CancellationToken token = new CancellationToken()) { var api = $"https://api.yuriimg.com/post/{id}"; @@ -27,7 +56,8 @@ public YuriimgSite() if (json == null) return; img.Score = $"{json.praise}".ToInt(); img.Date = $"{json.format_date}".ToDateTime(); - img.Urls.Add( 4, $"https://i.yuriimg.com/{json.src}"); + img.Urls.Add(3, TranslateImageUrl(json, 1)); + img.Urls.Add( 4, TranslateImageUrl(json,2)); img.Artist = $"{json.artist?.name}"; img.Uploader = $"{json.user?.name}"; img.UploaderId = $"{json.user?.id}"; @@ -68,6 +98,7 @@ public YuriimgSite() } + public override async Task GetRealPageImagesAsync(SearchPara para, CancellationToken token) { if (Net == null) Net = new NetOperator(Settings, HomeUrl); diff --git a/MoeLoaderP.Wpf/App.xaml b/MoeLoaderP.Wpf/App.xaml index 6611554..8f9c17c 100644 --- a/MoeLoaderP.Wpf/App.xaml +++ b/MoeLoaderP.Wpf/App.xaml @@ -10,6 +10,7 @@ + diff --git a/MoeLoaderP.Wpf/ControlParts/AboutControl.xaml b/MoeLoaderP.Wpf/ControlParts/AboutControl.xaml index 4940f2b..2c2fad3 100644 --- a/MoeLoaderP.Wpf/ControlParts/AboutControl.xaml +++ b/MoeLoaderP.Wpf/ControlParts/AboutControl.xaml @@ -35,15 +35,15 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +