| | 1 | | using System.Collections; |
| | 2 | | using System.Collections.Generic; |
| | 3 | | using System.IO; |
| | 4 | | using UnityEngine; |
| | 5 | |
|
| | 6 | | namespace DCL |
| | 7 | | { |
| | 8 | | public static class CommandLineParserUtils |
| | 9 | | { |
| 0 | 10 | | public static int startPort = 5000; |
| | 11 | | public static void ParseArguments() |
| | 12 | | { |
| 0 | 13 | | var debugConfig = GameObject.Find("DebugConfig").GetComponent<DebugConfigComponent>(); |
| | 14 | |
|
| 0 | 15 | | var arguments = System.Environment.GetCommandLineArgs(); |
| | 16 | |
|
| 0 | 17 | | for (var i = 0; i < arguments.Length; ++i) |
| | 18 | | { |
| 0 | 19 | | var argumentsLeft = arguments.Length - i - 1; |
| 0 | 20 | | var argument = arguments[i]; |
| | 21 | |
|
| 0 | 22 | | if (argumentsLeft >= 1) // Arguments with at least 1 parameter |
| | 23 | | { |
| | 24 | | switch (argument) |
| | 25 | | { |
| | 26 | | case "--url-params": |
| 0 | 27 | | i++; // shift |
| 0 | 28 | | debugConfig.customURL += arguments[i] + "&"; |
| 0 | 29 | | break; |
| | 30 | | case "--browser": |
| 0 | 31 | | i++; // shift |
| 0 | 32 | | debugConfig.OpenBrowserOnStart = arguments[i] == "true"; |
| 0 | 33 | | break; |
| | 34 | | case "--port": |
| 0 | 35 | | i++; // shift |
| 0 | 36 | | startPort = int.Parse(arguments[i]); |
| | 37 | | break; |
| | 38 | | } |
| | 39 | | } |
| | 40 | | } |
| 0 | 41 | | } |
| | 42 | | } |
| | 43 | | } |