public static void Shutdown() { ObjectDictionary.Clear(); ObjectNameDictionary.Clear(); foreach (KeyValuePair <IntPtr, IntPtr> pair in ObjectWrapperDictionary) { unsafe { Sim.DeleteObjectPtr((Sim.SimObjectPtr *)pair.Value); } } ObjectWrapperDictionary.Clear(); ObjectWrapperCountDictionary.Clear(); }
public static unsafe void UnregisterObjectPtr(IntPtr objectPtr) { if (!ObjectWrapperDictionary.ContainsKey(objectPtr)) { return; } Debug.Assert(ObjectWrapperCountDictionary[objectPtr] >= 0); ObjectWrapperCountDictionary[objectPtr]--; if (ObjectWrapperCountDictionary[objectPtr] <= 0) { Sim.DeleteObjectPtr((Sim.SimObjectPtr *)ObjectWrapperDictionary[objectPtr]); ObjectWrapperDictionary.Remove(objectPtr); ObjectWrapperCountDictionary.Remove(objectPtr); } }