Esempio n. 1
0
    //Code duplication
    private void AddControllerInformation(string inputString)
    {
        string controllerOrder = InputToolMethod.ReturnJoyStickOrder(inputString);

        //check controllers thats already been added to see if this is a duplicate.
        for (int i = 0; i < connectedControllers.Count; i++)
        {
            //Controllers should be unique and not added through one controller
            //and controller order isnt any of the previous
            bool controlleOrderRepeated = false;
            for (int j = 0; j < connectedControllers.Count; j++)
            {
                if (controllerOrder == connectedControllers[j].controllerOrder)
                {
                    controlleOrderRepeated = true;
                }
            }
            if (connectedControllers[i].controller == ControllerInformation.ControllerType.None && !controlleOrderRepeated)
            {
                connectedControllers[i] = new ControllerInformation();
                connectedControllers[i].controllerOrder = controllerOrder;
                connectedControllers[i].controller      = ControllerInformation.ControllerType.Controller;
                initializePanelAdapter.RefreshPanel();
                break;
            }
        }
    }
Esempio n. 2
0
    private void RemoveControllerInformation(string inputString)
    {
        string controllerOrder = InputToolMethod.ReturnJoyStickOrder(inputString);

        for (int i = 0; i < connectedControllers.Count; i++)
        {
            if (connectedControllers[i].controllerOrder == controllerOrder && connectedControllers[i].controller == ControllerInformation.ControllerType.Controller)
            {
                connectedControllers[i].ResetControllerInformation();
                initializePanelAdapter.RefreshPanel();
                break;
            }
        }
    }