A game about forced loneliness, made by TACStudios
1using System;
2
3namespace UnityEditor.TestRunner.CommandLineParser
4{
5 internal class CommandLineOptionSet
6 {
7 private ICommandLineOption[] m_Options;
8
9 public CommandLineOptionSet(params ICommandLineOption[] options)
10 {
11 m_Options = options;
12 }
13
14 public void Parse(string[] args)
15 {
16 var i = 0;
17 while (i < args.Length)
18 {
19 var arg = args[i];
20 if (!arg.StartsWith("-"))
21 {
22 i++;
23 continue;
24 }
25
26 string value = null;
27 if (i + 1 < args.Length && !args[i + 1].StartsWith("-"))
28 {
29 value = args[i + 1];
30 i++;
31 }
32
33 ApplyValueToMatchingOptions(arg, value);
34 i++;
35 }
36 }
37
38 private void ApplyValueToMatchingOptions(string argName, string value)
39 {
40 foreach (var option in m_Options)
41 {
42 if ("-" + option.ArgName == argName)
43 {
44 option.ApplyValue(value);
45 }
46 }
47 }
48 }
49}