/// <summary> /// Initializes the PCM. /// </summary> /// <param name="id">The identifier.</param> /// <returns></returns> public static bool InitializePCM(int id) { PCMData data; bool retVal = s_pcm.TryGetValue(id, out data); if (retVal) { //Contains key. return false saying we did not initialize a new one. return false; } else { //Create a new PCM data and return true. data = new PCMData(); s_pcm.Add(id, data); OnPCMAdded?.Invoke(data, null); return true; } }
/// <summary> /// Gets the PCM. /// </summary> /// <param name="id">The identifier.</param> /// <returns></returns> public static PCMData GetPCM(int id) { PCMData data; bool retVal = s_pcm.TryGetValue(id, out data); if (retVal) { //Contains key. Just return it return data; } else { data = new PCMData(); s_pcm.Add(id, data); OnPCMAdded?.Invoke(data, null); return data; } }