makes sure input is specified before checking other arguments now.
This commit is contained in:
parent
f442be1ba6
commit
58c3085f90
@ -41,37 +41,44 @@ namespace RecrownedAthenaeum.Tools.TextureAtlasTools
|
|||||||
texturePacker = new TexturePacker((arguments[i + 1]));
|
texturePacker = new TexturePacker((arguments[i + 1]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
texturePacker.Build();
|
if (texturePacker != null)
|
||||||
|
|
||||||
for (int i = 0; i < arguments.Length; i++)
|
|
||||||
{
|
{
|
||||||
if (arguments[i] == "-9p")
|
texturePacker.Build();
|
||||||
|
|
||||||
|
for (int i = 0; i < arguments.Length; i++)
|
||||||
{
|
{
|
||||||
if (i + 5 >= arguments.Length) throw new ArgumentException("-9p is not followed by proper specifiers for a 9Patch (format: \"-9p textureName,a,b,c,d\" where a, b, c, and d are integers definining the border regions for the 9patch.)");
|
if (arguments[i] == "-9p")
|
||||||
string[] nPatchArgs = arguments[i + 1].Split(',');
|
|
||||||
try
|
|
||||||
{
|
{
|
||||||
texturePacker.SetNinePatch(nPatchArgs[0], int.Parse(nPatchArgs[1]), int.Parse(nPatchArgs[2]), int.Parse(nPatchArgs[3]), int.Parse(nPatchArgs[4]));
|
if (i + 5 >= arguments.Length) throw new ArgumentException("-9p is not followed by proper specifiers for a 9Patch (format: \"-9p textureName,a,b,c,d\" where a, b, c, and d are integers definining the border regions for the 9patch.)");
|
||||||
} catch (FormatException)
|
string[] nPatchArgs = arguments[i + 1].Split(',');
|
||||||
{
|
try
|
||||||
throw new ArgumentException("-9p argument parameters must be in the format \"-9p textureName,a,b,c,d\" where a, b, c, and d are integers definining the border regions for the 9patch.");
|
{
|
||||||
|
texturePacker.SetNinePatch(nPatchArgs[0], int.Parse(nPatchArgs[1]), int.Parse(nPatchArgs[2]), int.Parse(nPatchArgs[3]), int.Parse(nPatchArgs[4]));
|
||||||
|
}
|
||||||
|
catch (FormatException)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("-9p argument parameters must be in the format \"-9p textureName,a,b,c,d\" where a, b, c, and d are integers definining the border regions for the 9patch.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < arguments.Length; i++)
|
for (int i = 0; i < arguments.Length; i++)
|
||||||
|
{
|
||||||
|
if (arguments[i] == "-o")
|
||||||
|
{
|
||||||
|
if (i + 1 >= arguments.Length) throw new ArgumentException("-o is not followed by path for output files. (eg. path/to/file where file is the name for the atlas.)");
|
||||||
|
texturePacker.Save(Path.GetDirectoryName(arguments[i + 1]), Path.GetFileName(arguments[i + 1]));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == arguments.Length - 1)
|
||||||
|
{
|
||||||
|
throw new ArgumentException("no -o argument found to specify output.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else
|
||||||
{
|
{
|
||||||
if (arguments[i] == "-o")
|
throw new ArgumentException("-i not specified.");
|
||||||
{
|
|
||||||
if (i + 1 >= arguments.Length) throw new ArgumentException("-o is not followed by path for output files. (eg. path/to/file where file is the name for the atlas.)");
|
|
||||||
texturePacker.Save(Path.GetDirectoryName(arguments[i + 1]), Path.GetFileName(arguments[i + 1]));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (i == arguments.Length - 1)
|
|
||||||
{
|
|
||||||
throw new ArgumentException("no -o argument found to specify output.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user