This commit is contained in:
Chenx221 2024-11-01 00:09:27 +08:00
parent 2559d4a438
commit 119ecb9cf9
Signed by: chenx221
GPG Key ID: D7A9EC07024C3021
2 changed files with 109 additions and 104 deletions

View File

@ -8,8 +8,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="13.10.0" />
<PackageReference Include="Magick.NET.Core" Version="13.10.0" />
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="14.0.0" />
<PackageReference Include="Magick.NET.Core" Version="14.0.0" />
<PackageReference Include="NLua" Version="1.7.3" />
<PackageReference Include="System.Threading.Tasks" Version="4.3.0" />
</ItemGroup>

View File

@ -12,26 +12,39 @@ namespace ArtemisFgTools
Console.WriteLine("请输入立绘fg文件夹的所在路径无需\"\"");
string? fgImagePath = Console.ReadLine();
Console.WriteLine("要合并的游戏有找到exlist吗(y/n) ");
Console.WriteLine("有找到exlist吗(y/n) ");
string spModeStr = Console.ReadLine() ?? throw new Exception("Invalid input");
bool spMode = (spModeStr == "n") || (spModeStr == "y" ? false : throw new Exception("Invalid input"));
string? luaFilePath = Console.ReadLine();
if (spMode)
{
dosth();
return;
}
Console.WriteLine("请输入保存位置:");
string? savePath = Console.ReadLine();
if (!Directory.Exists(savePath))
Directory.CreateDirectory(savePath);
if (string.IsNullOrEmpty(fgImagePath) || string.IsNullOrEmpty(luaFilePath) || string.IsNullOrEmpty(savePath))
if (spMode)
{
Console.WriteLine("请输入script文件夹的所在路径");
string? scriptPath = Console.ReadLine();
if (string.IsNullOrEmpty(fgImagePath) || string.IsNullOrEmpty(savePath) || string.IsNullOrEmpty(scriptPath))
{
Console.WriteLine("路径不能为空");
return;
}
if (!Directory.Exists(fgImagePath) || !Directory.Exists(scriptPath))
{
Console.WriteLine("路径不存在");
return;
}
List<FgObject> fgObjects = FetchFgObjectsFromScript(scriptPath);
Process(fgImagePath, savePath, size, fgObjects);
//我忘了size是干啥的了...
return;
}
Console.WriteLine("请输入exlist的文件路径");
string? luaFilePath = Console.ReadLine();
if (string.IsNullOrEmpty(fgImagePath) || string.IsNullOrEmpty(savePath) || string.IsNullOrEmpty(luaFilePath))
{
Console.WriteLine("路径不能为空");
return;
@ -41,10 +54,6 @@ namespace ArtemisFgTools
Console.WriteLine("路径不存在");
return;
}
if (!Directory.Exists(savePath))
{
Directory.CreateDirectory(savePath);
}
Dictionary<object, object>? dictionary = ParseLuaTable(luaFilePath);
@ -53,9 +62,7 @@ namespace ArtemisFgTools
if (dictionary["fg"] is Dictionary<object, object> fgDictionary)
{
if (fgDictionary["size"] is not List<object> size || size.Count == 0)
{
throw new Exception("size not found or empty");
}
fgDictionary.Remove("size");
//convert to FgObject
@ -78,6 +85,15 @@ namespace ArtemisFgTools
}
}
//jmp
Process(fgImagePath, savePath, size, fgObjects);
}
else
Console.WriteLine("fg not found");
}
}
private static void Process(string? fgImagePath, string? savePath, List<object> size, List<FgObject> fgObjects)
{
foreach (var fgObject in fgObjects)
{
foreach (var siz in size)
@ -157,17 +173,6 @@ namespace ArtemisFgTools
}
}
}
else
{
Console.WriteLine("fg not found");
}
}
}
private static void dosth()
{
throw new NotImplementedException();
}
private static void ProcessAndSave(string baseImg, string layerImg, string layer2Img, string target, bool special)
{