public void DiscoverRuntimes(string dataFilePath, UndertaleData data)
 {
     Runtimes.Clear();
     DiscoverGameExe(dataFilePath, data);
     DiscoverGMS2();
     DiscoverGMS1();
 }
        private async Task LoadAsync()
        {
            var rootUri = "https://api.nuviot.com/api/simulator/network/runtime";

            switch (_environment)
            {
            case Environments.Development:
                rootUri = "https://dev.nuviot.com/api/simulator/network/runtime";
                break;

            case Environments.Testing:
                rootUri = "https://test.nuviot.com/api/simulator/network/runtime";
                break;

            case Environments.LocalDevelopment:
                rootUri = "http://localhost:5001/api/simulator/network/runtime";
                break;

            default:
                break;
            }

            var requestId = Guid.NewGuid().ToId();
            var dateStamp = DateTime.UtcNow.ToJSONString();
            var version   = "1.0.0";

            var bldr = new StringBuilder();

            //Adding the \r\n manualy ensures that the we don't have any
            //platform specific code messing with our signature.
            bldr.Append($"{requestId}\r\n");
            bldr.Append($"{dateStamp}\r\n");
            bldr.Append($"{version}\r\n");
            bldr.Append($"{_org.Id}\r\n");
            bldr.Append($"{_user.Id}\r\n");
            bldr.Append($"{_simulatorNetworkId}\r\n");

            var sasKey = GetSignature(requestId, _simAccessKey, bldr.ToString());

            _adminLogger.AddCustomEvent(Core.PlatformSupport.LogLevel.Message, "SimulatorRuntimeManager_InitAsync", $"Requesting configuration from: {rootUri} ");
            Console.WriteLine($"Requesting configuration from: {rootUri}");


            var client = new HttpClient();

            client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("SAS", sasKey);
            client.DefaultRequestHeaders.Add(REQUEST_ID, requestId);
            client.DefaultRequestHeaders.Add(ORG_ID, _org.Id);
            client.DefaultRequestHeaders.Add(ORG, _org.Text);
            client.DefaultRequestHeaders.Add(USER_ID, _user.Id);
            client.DefaultRequestHeaders.Add(USER, _user.Text);
            client.DefaultRequestHeaders.Add(NETWORK_ID, _simulatorNetworkId);
            client.DefaultRequestHeaders.Add(DATE, dateStamp);
            client.DefaultRequestHeaders.Add(VERSION, version);

            try
            {
                var json = await client.GetStringAsync(rootUri);

                Runtimes.Clear();

                var network = JsonConvert.DeserializeObject <SimulatorNetwork>(json);
                Console.WriteLine($"Loaded simulator network {network.Name}");

                foreach (var sim in network.Simulators)
                {
                    var services = _factory.GetServices();
                    var runtime  = new SimulatorRuntime(services, Publisher, _adminLogger, sim);
                    await runtime.StartAsync();

                    Runtimes.Add(runtime);
                }
            }
            catch (Exception ex)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Error loading runtime.");
                Console.WriteLine(ex.Message);
                Console.ResetColor();
            }
        }