mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-11-30 04:54:20 +01:00
45 lines
1.4 KiB
C#
45 lines
1.4 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
|
|||
|
namespace DS4Windows
|
|||
|
{
|
|||
|
public class ControllerSlotManager
|
|||
|
{
|
|||
|
private List<DS4Device> controllerColl;
|
|||
|
public List<DS4Device> ControllerColl { get => controllerColl; set => controllerColl = value; }
|
|||
|
|
|||
|
private Dictionary<int, DS4Device> controllerDict;
|
|||
|
private Dictionary<DS4Device, int> reverseControllerDict;
|
|||
|
public Dictionary<int, DS4Device> ControllerDict { get => controllerDict; }
|
|||
|
public Dictionary<DS4Device, int> ReverseControllerDict { get => reverseControllerDict; }
|
|||
|
|
|||
|
public ControllerSlotManager()
|
|||
|
{
|
|||
|
controllerColl = new List<DS4Device>();
|
|||
|
controllerDict = new Dictionary<int, DS4Device>();
|
|||
|
reverseControllerDict = new Dictionary<DS4Device, int>();
|
|||
|
}
|
|||
|
|
|||
|
public void AddController(DS4Device device, int slotIdx)
|
|||
|
{
|
|||
|
controllerColl.Add(device);
|
|||
|
controllerDict.Add(slotIdx, device);
|
|||
|
reverseControllerDict.Add(device, slotIdx);
|
|||
|
}
|
|||
|
|
|||
|
public void RemoveController(DS4Device device, int slotIdx)
|
|||
|
{
|
|||
|
controllerColl.Remove(device);
|
|||
|
controllerDict.Remove(slotIdx);
|
|||
|
reverseControllerDict.Remove(device);
|
|||
|
}
|
|||
|
|
|||
|
public void ClearControllerList()
|
|||
|
{
|
|||
|
controllerColl.Clear();
|
|||
|
controllerDict.Clear();
|
|||
|
reverseControllerDict.Clear();
|
|||
|
}
|
|||
|
}
|
|||
|
}
|