/// <summary>
    /// Call this to start a thread to read a simulation output-file.
    /// If param is string, the IO expects a file name.
    /// If param is int, the IO expects a port number.
    /// </summary>
    /// <param name="param"></param>
    public void Read(System.Object param)
    {
        if (!Initialized())
        {
            return;
        }

        // Pause the game here and show the loading splash
        if (trafficController != null &&
            trafficController.typeOfIntegration != TrafficIntegrationController.TypeOfIntegration.SumoLiveIntegration &&
            trafficController.typeOfIntegration != TrafficIntegrationController.TypeOfIntegration.NoTrafficIntegration &&
            timeController != null)
        {
            timeController.RequestPauseGame();
            timeController.ShowLoadingIcon(true);
        }

        // Wait for traffDB reset in Unity-thread.
        Debug.Log("Waiting for trafficDB.");
        trafficDB.timeStepResetEvent.WaitOne(2000);
        Debug.Log("Waiting is over, trafficDB is ready.");

        timeSteps = new HashSet <float>();
        timeSteps.Clear();

        System.Diagnostics.Stopwatch stopwatch = new System.Diagnostics.Stopwatch();
        stopwatch.Start();

        if (param is string)
        {
            shouldStop = false;
            Read((string)param);
        }

        if (param is int)
        {
            shouldStop = false;
            Read((int)param);
        }

        stopwatch.Stop();
        Debug.Log("Read time elapsed: " + stopwatch.Elapsed);

        // Resume the game here and hide the loading splash
        if (trafficController != null &&
            trafficController.typeOfIntegration != TrafficIntegrationController.TypeOfIntegration.SumoLiveIntegration &&
            trafficController.typeOfIntegration != TrafficIntegrationController.TypeOfIntegration.NoTrafficIntegration &&
            timeController != null)
        {
            timeController.RequestResumeGame();
            timeController.ShowLoadingIcon(false);
            timeController.ActivateTimeSlider(trafficDB.getNumberOfTimeSteps());
        }
    }