修复坐标为负数时的意外情况

This commit is contained in:
Chenx221 2024-07-28 16:49:07 +08:00
parent 9f4ff27079
commit 513d9d541b

View File

@ -144,6 +144,11 @@ 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))
{ {
@ -284,7 +289,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)
{ {