mirror of
https://github.com/GhostPack/Lockless.git
synced 2026-11-08 08:06:09 -10:00
32 lines
919 B
C#
32 lines
919 B
C#
using System.Collections.Generic;
|
|
using System.Diagnostics;
|
|
|
|
namespace LockLess
|
|
{
|
|
public static class ArgumentParser
|
|
{
|
|
public static ArgumentParserResult Parse(IEnumerable<string> args)
|
|
{
|
|
var arguments = new Dictionary<string, string>();
|
|
try
|
|
{
|
|
foreach (var argument in args)
|
|
{
|
|
var idx = argument.IndexOf(':');
|
|
if (idx > 0)
|
|
arguments[argument.Substring(0, idx)] = argument.Substring(idx + 1);
|
|
else
|
|
arguments[argument] = string.Empty;
|
|
}
|
|
|
|
return ArgumentParserResult.Success(arguments);
|
|
}
|
|
catch (System.Exception ex)
|
|
{
|
|
Debug.WriteLine(ex.Message);
|
|
return ArgumentParserResult.Failure();
|
|
}
|
|
}
|
|
}
|
|
}
|