Skip to content

Commit

Permalink
9.5.3 new
Browse files Browse the repository at this point in the history
  • Loading branch information
xplusky committed Aug 31, 2021
1 parent 5a9f859 commit 8e30e55
Show file tree
Hide file tree
Showing 22 changed files with 803 additions and 51 deletions.
2 changes: 1 addition & 1 deletion MoeLoaderP.Core/DownloadItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion MoeLoaderP.Core/MoeItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
7 changes: 4 additions & 3 deletions MoeLoaderP.Core/MoeLoaderP.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="HtmlAgilityPack" Version="1.11.24" />
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="7.21.1" />
<PackageReference Include="HtmlAgilityPack" Version="1.11.36" />
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="8.2.1" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="SharpZipLib" Version="1.3.2" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 7 additions & 3 deletions MoeLoaderP.Core/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -258,15 +258,19 @@ public class AllMoeSitesSettings : Dictionary<string, SingleMoeSiteSettings> { }
public class SingleMoeSiteSettings : BindingObject
{
private string _loginCookie;
private Dictionary<string, string> _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<string, string> OtherSettings
{
get => _otherSettings;
set => SetField(ref _otherSettings, value, nameof(OtherSettings));
}
}

public class AllCustomSitesSettings : Dictionary<string, SingleCustomSiteSettings> { }
Expand Down
7 changes: 0 additions & 7 deletions MoeLoaderP.Core/Sites/CustomSiteFactory.cs

This file was deleted.

2 changes: 2 additions & 0 deletions MoeLoaderP.Core/Sites/MoeSite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


Expand Down
7 changes: 4 additions & 3 deletions MoeLoaderP.Core/Sites/PixivSite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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<int>();

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++)
{
Expand Down
4 changes: 2 additions & 2 deletions MoeLoaderP.Core/Sites/SankakuChanSite.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public SankakuChanSite()
{
DownloadTypes.Add("原图", 4);
LoginPageUrl = "https://beta.sankakucomplex.com/home";
SupportState.IsSupportAccount = true;
SupportState.IsSupportAccount = false;
SupportState.IsSupportStarButton = true;
}

Expand Down Expand Up @@ -69,7 +69,7 @@ public override async Task<MoeItems> GetRealPageImagesAsync(SearchPara para, Can
}
else
{
Net.CloneWithOldCookie();
Net = Net.CloneWithOldCookie();
}

Net.SetReferer(beta);
Expand Down
37 changes: 34 additions & 3 deletions MoeLoaderP.Core/Sites/YuriimgSite.cs
Original file line number Diff line number Diff line change
@@ -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
{
Expand All @@ -10,24 +12,52 @@ 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);
}

/// <summary>
/// 图片地址拼接 图片类型 0缩略图 1预览图 2原图
/// </summary>
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}";
var json = await Net.GetJsonAsync(api, token);
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}";
Expand Down Expand Up @@ -68,6 +98,7 @@ public YuriimgSite()

}


public override async Task<MoeItems> GetRealPageImagesAsync(SearchPara para, CancellationToken token)
{
if (Net == null) Net = new NetOperator(Settings, HomeUrl);
Expand Down
1 change: 1 addition & 0 deletions MoeLoaderP.Wpf/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
<!-- style --><ResourceDictionary Source="Assets/MoeResource.xaml" />
<!-- lang --><ResourceDictionary Source="Assets/Lang/zh-CN.xaml" />
<!-- lang override --><ResourceDictionary />
<ResourceDictionary Source="pack://application:,,,/FluentWPF;component/Styles/Controls.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
Expand Down
6 changes: 3 additions & 3 deletions MoeLoaderP.Wpf/ControlParts/AboutControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@
</LinearGradientBrush>
</Rectangle.Stroke>
</Rectangle>
<TextBlock x:Name="AboutVersionTextBlock" TextWrapping="Wrap" Text="版本" Margin="16,2,16,0"/>
<TextBlock x:Name="AboutVersionTextBlock" TextWrapping="Wrap" Text="版本" Margin="16,2,16,0" Foreground="Black"/>
<StackPanel x:Name="NewVersionPanel" Margin="0,4,0,0" Background="#FFFFDEDE">
<TextBlock x:Name="NewVersionTextBlock" TextWrapping="Wrap" Text="TextBlock" Foreground="#FF9E0000" Margin="4,4,4,0"/>
<Button x:Name="NewVersionDownloadButton" Content="前往下载新版" Template="{DynamicResource MoeButtonControlTemplate}" Height="24" Margin="4"/>
</StackPanel>
<TextBlock TextWrapping="Wrap" Margin="0,6,0,0"><Run Text="MoeLoader"/><Run Text=" "/><Run Text="P"/><Run Text=" "/><Run Text="的诞生离不开"/><Run Text=" "/><Run Text="Moe"/><Run Text=" "/><Run Text="Loader"/><Run Text=" "/><Run Text="开源项目以及以下开发者的贡献:esonic"/><Run Text="、YIU"/></TextBlock>
<TextBlock TextWrapping="Wrap" Margin="0,6,0,0" Foreground="Black"><Run Text="MoeLoader"/><Run Text=" "/><Run Text="P"/><Run Text=" "/><Run Text="的诞生离不开"/><Run Text=" "/><Run Text="Moe"/><Run Text=" "/><Run Text="Loader"/><Run Text=" "/><Run Text="开源项目以及以下开发者的贡献:esonic"/><Run Text="、YIU"/></TextBlock>
<Button x:Name="AboutHomeLinkButton" Content="使用帮助/更新记录" Margin="4,5,4,0" Template="{DynamicResource MoeButtonControlTemplate}" Height="24"/>
<Button x:Name="AboutReportButton" Content="反馈问题" Margin="4,5,4,0" Template="{DynamicResource MoeButtonControlTemplate}" Height="24"/>
<TextBlock TextWrapping="Wrap" Margin="0,6,0,0"><Run Text="若你喜欢本软件的话可以请我喝杯饮料哦~"/><LineBreak/><Run/><Run x:Name="AboutDonateLink" Cursor="Hand" Foreground="DarkRed" FontWeight="Bold" Text="支付宝" TextDecorations="Underline"/><Run Text=""/><Run Text=" "/><Run x:Name="AboutDonateWexinLink" Cursor="Hand" Foreground="DarkRed" FontWeight="Bold" Text="微信支付" TextDecorations="Underline"/><Run Text="均可"/><Run Text=",可以备注昵称和网址。"/></TextBlock>
<TextBlock Foreground="Black" TextWrapping="Wrap" Margin="0,6,0,0"><Run Text="若你喜欢本软件的话可以请我喝杯饮料哦~"/><LineBreak/><Run/><Run x:Name="AboutDonateLink" Cursor="Hand" Foreground="DarkRed" FontWeight="Bold" Text="支付宝" TextDecorations="Underline"/><Run Text=""/><Run Text=" "/><Run x:Name="AboutDonateWexinLink" Cursor="Hand" Foreground="DarkRed" FontWeight="Bold" Text="微信支付" TextDecorations="Underline"/><Run Text="均可"/><Run Text=",可以备注昵称和网址。"/></TextBlock>
<TextBlock TextWrapping="Wrap" Text="感谢下列用户的捐助!" Margin="0,6,0,0"/>
<WrapPanel x:Name="ThanksUserWrapPanel"/>
</StackPanel>
Expand Down
14 changes: 7 additions & 7 deletions MoeLoaderP.Wpf/ControlParts/SettingsControl.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,13 @@
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<TextBlock TextWrapping="Wrap" VerticalAlignment="Center" Height="15.24" Margin="0,10,0,7.88" Text="{DynamicResource TextSettingsParallelLoadMaxCount}"/>
<TextBlock TextWrapping="Wrap" VerticalAlignment="Center" Height="15.24" Margin="0,10,0,7.88" Text="{DynamicResource TextSettingsParallelLoadMaxCount}" Foreground="Black"/>
<controlParts:VariableCountControl x:Name="ImageParallelLoadMaxCountBox" Grid.Column="1" MinCount="5" MaxCount="20" NumCount="{Binding MaxOnLoadingImageCount, Mode=TwoWay}" Width="150" Height="24"/>
<TextBlock TextWrapping="Wrap" Text="{DynamicResource TextSettingsHistoryMaxCount}" VerticalAlignment="Center" Height="15.24" Margin="0,7.228,0,10.652" Grid.Row="1"/>
<TextBlock TextWrapping="Wrap" Text="{DynamicResource TextSettingsHistoryMaxCount}" VerticalAlignment="Center" Height="15.24" Margin="0,7.228,0,10.652" Grid.Row="1" Foreground="Black"/>
<controlParts:VariableCountControl x:Name="HistoryMaxCountBox" Grid.Column="1" MinCount="5" MaxCount="30" NumCount="{Binding HistoryKeywordsMaxCount, Mode=TwoWay}" Grid.Row="1" Width="150" Height="24"/>
</Grid>
<Button x:Name="ClearHistoryButton" Content="{DynamicResource TextSettingsClearHistory}" Template="{DynamicResource MoeButtonControlTemplate}" Height="24" Margin="0,4,0,0"/>
<CheckBox x:Name="ClearImgsWhenSerachNextPageCheckBox" Content="搜索下一页时清除当前页图片" IsChecked="{Binding IsClearImgsWhenSerachNextPage}" Margin="0,6,0,0"/>
<CheckBox x:Name="ClearImgsWhenSerachNextPageCheckBox" Content="搜索下一页时清除当前页图片" IsChecked="{Binding IsClearImgsWhenSerachNextPage}" Margin="0,6,0,0" Foreground="Black"/>
</StackPanel>
</GroupBox>

Expand All @@ -84,7 +84,7 @@
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<controlParts:VariableCountControl x:Name="ParallelDownloadingMaxCountBox" MinCount="1" MaxCount="15" NumCount="{Binding MaxOnDownloadingImageCount, Mode=TwoWay}" Grid.Column="1" Width="150" Height="24"/>
<TextBlock TextWrapping="Wrap" Text="{DynamicResource TextSettingsDownloadParallelDownloadingCount}" VerticalAlignment="Center"/>
<TextBlock TextWrapping="Wrap" Text="{DynamicResource TextSettingsDownloadParallelDownloadingCount}" VerticalAlignment="Center" Foreground="Black"/>
</Grid>
<Grid Height="25" Margin="0,2,0,0">
<Grid.ColumnDefinitions>
Expand All @@ -98,7 +98,7 @@
</Grid>
<TextBlock
HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="0,4"><Run Text="图片"/><Run Text="存储文件夹位置"/></TextBlock>
VerticalAlignment="Top" Margin="0,4" Foreground="Black"><Run Text="图片"/><Run Text="存储文件夹位置"/></TextBlock>
<Grid Margin="0,0,0,4">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="215*"/>
Expand All @@ -120,7 +120,7 @@
</Grid>
<TextBlock
HorizontalAlignment="Left"
VerticalAlignment="Top" Margin="0,2,0,0"><Run Text="自定义"/><Run Text="图片保存"/><Run Text=""/><Run Text="文件夹"/></TextBlock>
VerticalAlignment="Top" Margin="0,2,0,0" Foreground="Black"><Run Text="自定义"/><Run Text="图片保存"/><Run Text=""/><Run Text="文件夹"/></TextBlock>
<Grid x:Name="SortFolderNameFormatGrid" Height="26" Margin="0,2" >
<Grid.ColumnDefinitions>
<ColumnDefinition/>
Expand All @@ -142,7 +142,7 @@
</Grid>
<TextBlock
HorizontalAlignment="Left"
VerticalAlignment="Top" Text="自定义文件命名格式(不带扩展名)" Margin="0,2"/>
VerticalAlignment="Top" Text="自定义文件命名格式(不带扩展名)" Margin="0,2" Foreground="Black"/>
<Grid Height="26">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
Expand Down
8 changes: 7 additions & 1 deletion MoeLoaderP.Wpf/LoginWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,14 @@ private async void AuthButtonOnClick(object sender, RoutedEventArgs e)
return;
}
AuthMesTextBlock.Text = "认证成功,4秒后将关闭窗口";
await Task.Delay(1000);
AuthMesTextBlock.Text = "认证成功,3秒后将关闭窗口";
await Task.Delay(1000);
AuthMesTextBlock.Text = "认证成功,2秒后将关闭窗口";
await Task.Delay(1000);
AuthMesTextBlock.Text = "认证成功,1秒后将关闭窗口";
await Task.Delay(1000);
Site.CurrentSiteSetting.LoginCookie = _cookies;
await Task.Delay(4000);
Close();
}));
}
Expand Down
Loading

0 comments on commit 8e30e55

Please sign in to comment.