Compare commits

..

No commits in common. "e1c83d9d13c0b988d1f87d8697b030b507f1737a" and "9f4ff27079a310621161a6a8fd4382337e1542f9" have entirely different histories.

2 changed files with 8 additions and 14 deletions

View File

@ -11,7 +11,6 @@
<PackageReference Include="Magick.NET-Q16-AnyCPU" Version="13.10.0" /> <PackageReference Include="Magick.NET-Q16-AnyCPU" Version="13.10.0" />
<PackageReference Include="Magick.NET.Core" Version="13.10.0" /> <PackageReference Include="Magick.NET.Core" Version="13.10.0" />
<PackageReference Include="NLua" Version="1.7.3" /> <PackageReference Include="NLua" Version="1.7.3" />
<PackageReference Include="System.Threading.Tasks" Version="4.3.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

View File

@ -1,6 +1,7 @@
using ImageMagick; using ImageMagick;
using NLua; using NLua;
using System.Text.RegularExpressions; using System.Text.RegularExpressions;
using System.Xml.Linq;
namespace ArtemisFgTools namespace ArtemisFgTools
{ {
internal class Program internal class Program
@ -80,13 +81,12 @@ namespace ArtemisFgTools
string pathWithSize = Path.Combine(fgImagePath, fgObject.Path, siz.ToString() ?? string.Empty); string pathWithSize = Path.Combine(fgImagePath, fgObject.Path, siz.ToString() ?? string.Empty);
foreach (var pose in fgObject.Pose) foreach (var pose in fgObject.Pose)
{ {
Parallel.ForEach(fgObject.Fuku, fuku => foreach (var fuku in fgObject.Fuku)
//foreach (var in )
{ {
bool special = false; bool special = false;
string fuku_current = fuku; string fuku_current = fuku;
//if the tail of fuku is |0099, spec to true & remove |0099 //if the tail of fuku is |0099, spec to true & remove |0099
if (fuku_current.EndsWith("|0099")) if (fuku.EndsWith("|0099"))
{ {
special = true; special = true;
fuku_current = fuku[0..^5]; fuku_current = fuku[0..^5];
@ -102,7 +102,7 @@ namespace ArtemisFgTools
ProcessAndSave(baseImg, layerImg, layer2Img, savePathWithAll, special); ProcessAndSave(baseImg, layerImg, layer2Img, savePathWithAll, special);
} }
}); }
} }
} }
} }
@ -113,11 +113,11 @@ namespace ArtemisFgTools
string pathWithSize = Path.Combine(fgImagePath, fgObject.Path, siz2.ToString() ?? string.Empty); string pathWithSize = Path.Combine(fgImagePath, fgObject.Path, siz2.ToString() ?? string.Empty);
foreach (var pose in fgObject.Pose) foreach (var pose in fgObject.Pose)
{ {
Parallel.ForEach(fgObject.Fuku, fuku => foreach (var fuku in fgObject.Fuku)
{ {
bool special = false; bool special = false;
string fuku_current = fuku; string fuku_current = fuku;
if (fuku_current.EndsWith("|0099")) if (fuku.EndsWith("|0099"))
{ {
special = true; special = true;
fuku_current = fuku[0..^5]; fuku_current = fuku[0..^5];
@ -130,7 +130,7 @@ namespace ArtemisFgTools
string savePathWithAll = Path.Combine(savePathWithSizePart, $"{fgObject.Head}no{pose[0]}{fuku_current}{pose[1]}0_{face}" + (special ? ($"_{pose[0]}0099.png") : (".png"))); string savePathWithAll = Path.Combine(savePathWithSizePart, $"{fgObject.Head}no{pose[0]}{fuku_current}{pose[1]}0_{face}" + (special ? ($"_{pose[0]}0099.png") : (".png")));
ProcessAndSave(baseImg, layerImg, layer2Img, savePathWithAll, special); ProcessAndSave(baseImg, layerImg, layer2Img, savePathWithAll, special);
} }
}); }
} }
} }
} }
@ -144,11 +144,6 @@ namespace ArtemisFgTools
private static void ProcessAndSave(string baseImg, string layerImg, string layer2Img, string target, bool special) private static void ProcessAndSave(string baseImg, string layerImg, string layer2Img, string target, bool special)
{ {
if (File.Exists(target))
{
Console.WriteLine($"{Path.GetFileName(target)}已存在,跳过!");
return;
}
string? directory = Path.GetDirectoryName(target); string? directory = Path.GetDirectoryName(target);
if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory)) if (!string.IsNullOrEmpty(directory) && !Directory.Exists(directory))
{ {
@ -289,7 +284,7 @@ namespace ArtemisFgTools
{ {
if (comment != null) if (comment != null)
{ {
string pattern = @"^pos,(-?\d+),(-?\d+),(-?\d+),(-?\d+)$"; string pattern = @"^pos,(\d+),(\d+),(\d+),(\d+)$";
Match match = Regex.Match(comment, pattern); Match match = Regex.Match(comment, pattern);
if (match.Success) if (match.Success)
{ {