mirror of
https://github.com/bloxstraplabs/bloxstrap.git
synced 2025-04-21 10:01:27 -07:00
move flagMap inside the ctor function
This commit is contained in:
parent
fe8643a2d7
commit
c8e55a786a
@ -57,8 +57,6 @@ namespace Bloxstrap
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public string[] Args { get; private set; }
|
public string[] Args { get; private set; }
|
||||||
|
|
||||||
private readonly Dictionary<string, LaunchFlag> _flagMap = new();
|
|
||||||
|
|
||||||
public LaunchSettings(string[] args)
|
public LaunchSettings(string[] args)
|
||||||
{
|
{
|
||||||
const string LOG_IDENT = "LaunchSettings::LaunchSettings";
|
const string LOG_IDENT = "LaunchSettings::LaunchSettings";
|
||||||
@ -69,6 +67,8 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
Args = args;
|
Args = args;
|
||||||
|
|
||||||
|
Dictionary<string, LaunchFlag> flagMap = new();
|
||||||
|
|
||||||
// build flag map
|
// build flag map
|
||||||
foreach (var prop in this.GetType().GetProperties())
|
foreach (var prop in this.GetType().GetProperties())
|
||||||
{
|
{
|
||||||
@ -79,7 +79,7 @@ namespace Bloxstrap
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
foreach (string identifier in flag.Identifiers.Split(','))
|
foreach (string identifier in flag.Identifiers.Split(','))
|
||||||
_flagMap.Add(identifier, flag);
|
flagMap.Add(identifier, flag);
|
||||||
}
|
}
|
||||||
|
|
||||||
int startIdx = 0;
|
int startIdx = 0;
|
||||||
@ -119,7 +119,7 @@ namespace Bloxstrap
|
|||||||
|
|
||||||
string identifier = arg[1..];
|
string identifier = arg[1..];
|
||||||
|
|
||||||
if (!_flagMap.TryGetValue(identifier, out LaunchFlag? flag) || flag is null)
|
if (!flagMap.TryGetValue(identifier, out LaunchFlag? flag) || flag is null)
|
||||||
{
|
{
|
||||||
App.Logger.WriteLine(LOG_IDENT, $"Unknown argument: {identifier}");
|
App.Logger.WriteLine(LOG_IDENT, $"Unknown argument: {identifier}");
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user