手搓工具支持文件夹循环

This commit is contained in:
ZouJin 2023-10-19 17:58:33 +08:00
parent a6c1308b85
commit 95715df65b
5 changed files with 20 additions and 62 deletions

View File

@ -46,15 +46,21 @@ namespace VPet_Simulator.Tool
{ {
Console.WriteLine("请输入图片位置"); Console.WriteLine("请输入图片位置");
DirectoryInfo directoryInfo = new DirectoryInfo(Console.ReadLine()); DirectoryInfo directoryInfo = new DirectoryInfo(Console.ReadLine());
if (directoryInfo.GetFiles().Length != 0) AnimationReNameFolder(time, directoryInfo);
AnimationReName(time, directoryInfo);
else
foreach (var fs in directoryInfo.GetDirectories())
{
AnimationReName(time, fs);
}
} }
} }
static void AnimationReNameFolder(int time, DirectoryInfo directoryInfo)
{
if (directoryInfo.GetFiles("*.png").Length != 0)
AnimationReName(time, directoryInfo);
else
foreach (var fs in directoryInfo.GetDirectories())
{
AnimationReNameFolder(time, fs);
}
}
static void AnimationReName(int time, DirectoryInfo directoryInfo) static void AnimationReName(int time, DirectoryInfo directoryInfo)
{ {
int id = 0; int id = 0;
@ -86,56 +92,8 @@ namespace VPet_Simulator.Tool
lastf.MoveTo(Path.Combine(directoryInfo.FullName, $"{GetFileName(lastf)}_{id++:D3}_{rpt * time}.png")); lastf.MoveTo(Path.Combine(directoryInfo.FullName, $"{GetFileName(lastf)}_{id++:D3}_{rpt * time}.png"));
Console.WriteLine("图片处理已完成"); Console.WriteLine("图片处理已完成");
} }
//static void FontPetNew()
//{
// Console.WriteLine("请输入储存位置");
// DirectoryInfo directoryInfo = new DirectoryInfo(Console.ReadLine());
// var elist = Properties.Resources.laenum.Replace(" ", "").Replace("/// <summary>", "")
// .Replace("/// </summary>", "").Replace("/// ", "").Replace("\r", "").Replace("\n\n", "\n")
// .Replace("\n\n", "\n").Replace("\n\n", "\n").Split('\n').ToList();
// elist.RemoveAll(x => x.EndsWith(","));
// for (int i = 0; i < elist.Count; i++)
// {
// var paths = GraphTypeValue[i].Split('_');
// DirectoryInfo nowpath = directoryInfo;
// foreach (var path in paths)
// {
// nowpath = nowpath.CreateSubdirectory(path);
// }
// foreach (string v in Enum.GetNames(typeof(GameSave.ModeType)))
// {
// using (Bitmap image = new Bitmap(500, 500))
// {
// using (Graphics g = Graphics.FromImage(image))
// {
// var strs = elist[i].Split(' ');
// g.DrawString(strs[0], new Font("胡晓波男神体2.0", 66, FontStyle.Bold), new SolidBrush(Color.DarkSlateBlue), 10, 100);
// g.DrawString(strs[0], new Font("胡晓波男神体2.0", 64), new SolidBrush(Color.AliceBlue), 15, 100);
// for (int j = 1; j < strs.Length - 1; j++)
// {
// g.DrawString(strs[j], new Font("胡晓波萌萌体", 50, FontStyle.Bold), new SolidBrush(Color.LightGray), 10, 150 + 50 * j);
// g.DrawString(strs[j], new Font("胡晓波萌萌体", 48, FontStyle.Bold), new SolidBrush(Color.Gray), 15, 150 + 50 * j);
// }
// g.DrawString(v, new Font("胡晓波润圆体35", 50, FontStyle.Bold), new SolidBrush(Color.DeepSkyBlue), 10, 350);
// g.DrawString(v, new Font("胡晓波润圆体35", 48, FontStyle.Bold), new SolidBrush(Color.SkyBlue), 15, 350);
// int len = 2000;
// var last = strs.Last();
// if(last == "S")
// {
// len = 250;
// }
// else if (last == "M")
// {
// len = 1000;
// }
// image.Save(nowpath.CreateSubdirectory(v).FullName + $"\\{paths[0]}_{len}.png");
// }
// }
// }
// }
//}
public static string GetFileHash(FileInfo fileInfo) public static string GetFileHash(FileInfo fileInfo)
{ {
//创建一个哈希算法对象 //创建一个哈希算法对象

View File

@ -3,7 +3,7 @@ mklink /d "%~dp0\bin\x64\Debug\net462\mod" "%~dp0\mod"
mklink /d "%~dp0\bin\x64\Release\net462\mod" "%~dp0\mod" mklink /d "%~dp0\bin\x64\Release\net462\mod" "%~dp0\mod"
mklink /d "%~dp0\mod\0001_ModMaker" "%~dp0\..\..\VPet.ModMaker\0001_ModMaker" mklink /d "%~dp0\mod\0001_ModMaker" "%~dp0\..\..\VPet.ModMaker\0001_ModMaker"
mklink /d "%~dp0\mod\1100_DemoClock" "%~dp0\..\..\VPet.Plugin.DemoClock\VPet.Plugin.DemoClock\1100_DemoClock" mklink /d "%~dp0\mod\1100_DemoClock" "%~dp0\..\..\VPet.Plugin.Demo\VPet.Plugin.DemoClock\1100_DemoClock"
mklink /d "%~dp0\mod\1101_EdgeTTS" "%~dp0\..\..\VPet.Plugin.DemoClock\VPet.Plugin.EdgeTTS\1101_EdgeTTS" mklink /d "%~dp0\mod\1101_EdgeTTS" "%~dp0\..\..\VPet.Plugin.Demo\VPet.Plugin.EdgeTTS\1101_EdgeTTS"
mklink /d "%~dp0\mod\1110_ChatGPT" "%~dp0\..\..\VPet.Plugin.DemoClock\VPet.Plugin.ChatGPT\1110_ChatGPT" mklink /d "%~dp0\mod\1110_ChatGPT" "%~dp0\..\..\VPet.Plugin.Demo\VPet.Plugin.ChatGPT\1110_ChatGPT"
pause pause

View File

@ -1 +1 @@
D:/Documents/Visual Studio 2022/Projects/VPet.Plugin.DemoClock/VPet.Plugin.DemoClock/1100_DemoClock D:/Documents/Visual Studio 2022/Projects/VPet.Plugin.Demo/VPet.Plugin.DemoClock/1100_DemoClock

View File

@ -1 +1 @@
D:/Documents/Visual Studio 2022/Projects/VPet.Plugin.DemoClock/VPet.Plugin.EdgeTTS/1101_EdgeTTS D:/Documents/Visual Studio 2022/Projects/VPet.Plugin.Demo/VPet.Plugin.EdgeTTS/1101_EdgeTTS

View File

@ -1 +1 @@
D:/Documents/Visual Studio 2022/Projects/VPet.Plugin.DemoClock/VPet.Plugin.ChatGPT/1110_ChatGPT D:/Documents/Visual Studio 2022/Projects/VPet.Plugin.Demo/VPet.Plugin.ChatGPT/1110_ChatGPT