Skip to content

Commit

Permalink
Merge branch 'v0.8.1-dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
GardenHamster committed Mar 4, 2023
2 parents 21e06d1 + 2537d40 commit 102275a
Show file tree
Hide file tree
Showing 62 changed files with 547 additions and 668 deletions.
190 changes: 0 additions & 190 deletions Document.md

This file was deleted.

53 changes: 0 additions & 53 deletions MysqlInstall.md

This file was deleted.

12 changes: 7 additions & 5 deletions Theresa3rd-Bot/TheresaBot.Main/Business/LocalSetuBusiness.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,17 @@ namespace TheresaBot.Main.Business
{
public class LocalSetuBusiness : SetuBusiness
{
public List<LocalSetuInfo> loadRandom(string localPath, int count, bool fromOneDir = false)
public List<LocalSetuInfo> loadRandomDir(string localPath, int count, bool fromOneDir = false)
{
List<LocalSetuInfo> setuList = new List<LocalSetuInfo>();
DirectoryInfo localDir = new DirectoryInfo(localPath);
DirectoryInfo[] directoryInfos = localDir.GetDirectories();
int randomDirIndex = new Random().Next(0, directoryInfos.Length);
if (directoryInfos.Length == 0) throw new Exception($"localPath路径下不存在子文件夹,请在子文件夹下存放图片");
int singleDirIndex = new Random().Next(0, directoryInfos.Length);
for (int i = 0; i < count; i++)
{
randomDirIndex = fromOneDir ? randomDirIndex : new Random().Next(0, directoryInfos.Length);
DirectoryInfo randomDir = directoryInfos[randomDirIndex];
int dirIndex = fromOneDir ? singleDirIndex : new Random().Next(0, directoryInfos.Length);
DirectoryInfo randomDir = directoryInfos[dirIndex];
FileInfo[] fileInfos = randomDir.GetFiles();
if (fileInfos.Length == 0) continue;
int randomFileIndex = new Random().Next(0, fileInfos.Length);
Expand All @@ -25,11 +26,12 @@ public List<LocalSetuInfo> loadRandom(string localPath, int count, bool fromOneD
return setuList;
}

public List<LocalSetuInfo> loadInDir(string localPath, string dirName, int count)
public List<LocalSetuInfo> loadTargetDir(string localPath, string dirName, int count)
{
List<LocalSetuInfo> setuList = new List<LocalSetuInfo>();
DirectoryInfo localDir = new DirectoryInfo(localPath);
DirectoryInfo[] directoryInfos = localDir.GetDirectories();
if (directoryInfos is null || directoryInfos.Length == 0) return setuList;
DirectoryInfo directoryInfo = directoryInfos.Where(o => o.Name.ToLower() == dirName.ToLower()).FirstOrDefault();
if (directoryInfo is null) return setuList;
FileInfo[] fileInfos = directoryInfo.GetFiles();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ public async Task<List<PixivRankingDetail>> filterContents(PixivRankingItem rank
await Task.Delay(500);
if (pixivWorkInfo is null) continue;
if (checkWorkIsOk(rankingItem, pixivWorkInfo) == false) continue;
FileInfo previewFile = await PixivHelper.DownPixivImgAsync(rankingContent.illust_id.ToString(), rankingContent.url);
string fullFileName = rankingContent.url.GetPreviewImgSaveName(pixivWorkInfo.illustId);
FileInfo previewFile = await PixivHelper.DownPixivImgAsync(rankingContent.illust_id.ToString(), rankingContent.url, fullFileName);
PixivRankingDetail rankingDetail = new PixivRankingDetail(rankingContent, pixivWorkInfo, previewFile?.FullName);
rankingDetails.Add(rankingDetail);
}
Expand Down
6 changes: 3 additions & 3 deletions Theresa3rd-Bot/TheresaBot.Main/Common/BotConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@ namespace TheresaBot.Main.Common
{
public static class BotConfig
{
public const string BotVersion = "v0.8.0";
public const string BotVersion = "v0.8.1";
public const string BotHomepage = "https://www.theresa3rd.cn";
public static DBConfig DBConfig = new DBConfig();
public static MiraiConfig MiraiConfig = new MiraiConfig();
public static GeneralConfig GeneralConfig = new GeneralConfig();
public static PixivConfig PixivConfig = new PixivConfig();
public static PermissionsConfig PermissionsConfig = new PermissionsConfig();
Expand All @@ -29,5 +27,7 @@ public static class BotConfig
public static List<BanWordPO> BanSetuTagList = new List<BanWordPO>();
public static List<BanWordPO> BanMemberList = new List<BanWordPO>();



}
}
Loading

0 comments on commit 102275a

Please sign in to comment.