From 470195c8ca3f842997df2b483f0334d9f78244ac Mon Sep 17 00:00:00 2001 From: MATRIX-feather Date: Fri, 4 Mar 2022 12:40:07 +0800 Subject: [PATCH] =?UTF-8?q?misc:=20=E8=B0=83=E6=95=B4=E4=BF=9D=E5=AD=98?= =?UTF-8?q?=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: MATRIX-feather --- Generator/TextureGenerator.cs | 17 +++++++++-------- TextureOverlayer.csproj | 2 -- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Generator/TextureGenerator.cs b/Generator/TextureGenerator.cs index 7f969f0..f410749 100644 --- a/Generator/TextureGenerator.cs +++ b/Generator/TextureGenerator.cs @@ -58,16 +58,17 @@ public void Generate(TexGenConfig texGenConfig) if (texGenConfig.OutputTargets?.Length > 0 && !string.IsNullOrEmpty(texGenConfig.OutputTarget)) throw new InvalidOperationException("为什么要同时设置output_target和output_targets?"); - if (texGenConfig.OutputTargets != null) - { - foreach (var fname in texGenConfig.OutputTargets) - baseImage.Save(fname); - } + var outputTargets = texGenConfig.OutputTargets?.ToList() ?? new List(); + + if (texGenConfig.OutputTargets == null && !string.IsNullOrEmpty(texGenConfig.OutputTarget)) + outputTargets.Add(texGenConfig.OutputTarget); - if (!string.IsNullOrEmpty(texGenConfig.OutputTarget)) - baseImage.Save(texGenConfig.OutputTarget); + foreach (var fname in outputTargets) + { + if (!Directory.Exists(fname)) Directory.CreateDirectory(Path.GetDirectoryName(fname)); - //overlayImage.Save(texGenConfig.OutputTarget + "_OVERLAY.png"); + baseImage.Save(fname); + } } private void overlayColor(Image source, Color color) diff --git a/TextureOverlayer.csproj b/TextureOverlayer.csproj index edb8e2b..1b6515b 100644 --- a/TextureOverlayer.csproj +++ b/TextureOverlayer.csproj @@ -10,8 +10,6 @@ - -