ninepatch command argument -o is now optional.
This commit is contained in:
parent
122826248d
commit
9ab70fd291
@ -20,7 +20,7 @@ namespace RecrownedAthenaeum.Tools.NinePatchTools
|
||||
arguments = new EngineCommandArgument[6];
|
||||
|
||||
arguments[0] = new EngineCommandArgument("-i", "defines the path to the texture to be used for the nine patch.", true);
|
||||
arguments[1] = new EngineCommandArgument("-o", "defines path of output file.", true);
|
||||
arguments[1] = new EngineCommandArgument("-o", "defines path of output file.");
|
||||
arguments[2] = new EngineCommandArgument("-l", "left patch.", true);
|
||||
arguments[3] = new EngineCommandArgument("-r", "right patch.", true);
|
||||
arguments[4] = new EngineCommandArgument("-u", "up patch.", true);
|
||||
@ -32,11 +32,17 @@ namespace RecrownedAthenaeum.Tools.NinePatchTools
|
||||
if (arguments == null) throw new ArgumentException("Missing arguments. Type \"help 9p\" for more information.");
|
||||
int leftBound = 0, rightBound = 0, topBound = 0, bottomBound = 0;
|
||||
string imagePath, outPath;
|
||||
if (IndexOfArgumentIn("-i", arguments) + 1 >= arguments.Length) throw new ArgumentException("Missing -i argument path.");
|
||||
if (IndexOfArgumentIn("-i", arguments) + 1 >= arguments.Length) throw new ArgumentException("Missing -i path after argument.");
|
||||
imagePath = arguments[IndexOfArgumentIn("-i", arguments) + 1];
|
||||
|
||||
if (IndexOfArgumentIn("-o", arguments) + 1 >= arguments.Length) throw new ArgumentException("Missing -o argument path.");
|
||||
if (HasArgument(arguments[1], arguments))
|
||||
{
|
||||
if (IndexOfArgumentIn("-o", arguments) + 1 >= arguments.Length) throw new ArgumentException("Missing -o path after argument.");
|
||||
outPath = arguments[IndexOfArgumentIn("-o", arguments) + 1];
|
||||
} else
|
||||
{
|
||||
outPath = Path.GetFileNameWithoutExtension(imagePath);
|
||||
}
|
||||
|
||||
if (IndexOfArgumentIn("-l", arguments) + 1 >= arguments.Length && !int.TryParse(arguments[IndexOfArgumentIn("-l", arguments) + 1], out leftBound)) throw new ArgumentException("Missing -l argument bound.");
|
||||
if (IndexOfArgumentIn("-r", arguments) + 1 >= arguments.Length && !int.TryParse(arguments[IndexOfArgumentIn("-r", arguments) + 1], out rightBound)) throw new ArgumentException("Missing -r argument bound.");
|
||||
|
Loading…
Reference in New Issue
Block a user