Files
HawkeyeVision/VisionBuilder.UI.Common/CommandLineParser.cs
meelstorm dec036dbcf 2.0.9
2025-10-15 15:58:27 +02:00

35 lines
759 B
C#

namespace VisionBuilder.UI.Common;
public class CommandLineParser
{
private readonly List<string> _args;
public CommandLineParser(string[] args)
{
_args = args.ToList();
}
public string? GetStringArgument(string key, char shortKey)
{
var index = _args.IndexOf("--" + key);
if (index >= 0 && _args.Count > index)
{
return _args[index + 1];
}
index = _args.IndexOf("-" + shortKey);
if (index >= 0 && _args.Count > index)
{
return _args[index + 1];
}
return null;
}
public bool GetSwitchArgument(bool value, char shortKey)
{
return _args.Contains("--" + value) || _args.Contains("-" + shortKey);
}
}