public void RemoveWatch(IDataWatchHandle handle) { DataWatchHandle handleImpl = (DataWatchHandle)handle; if (m_Handles.Remove(handleImpl.id)) { Watchers watchers; if (m_Watched.TryGetValue(handleImpl.watched, out watchers)) { List <Spy> spyList = watchers.spyList; for (int i = 0; i < spyList.Count; i++) { Spy spy = spyList[i]; if (spy.handleID == handleImpl.id) { spyList.RemoveAt(i); if (watchers.IsEmpty()) { DoRemoveWatcher(watchers); } } } } return; } throw new ArgumentException("Data watch was not registered"); }
public void RemoveWatch(IDataWatchHandle handle) { DataWatchHandle dataWatchHandle = (DataWatchHandle)handle; if (this.m_Handles.Remove(dataWatchHandle.id)) { DataWatchService.Watchers watchers; if (this.m_Watched.TryGetValue(dataWatchHandle.watched, out watchers)) { List <DataWatchService.Spy> spyList = watchers.spyList; for (int i = 0; i < spyList.Count; i++) { if (spyList[i].handleID == dataWatchHandle.id) { spyList.RemoveAt(i); if (watchers.spyList.Count == 0) { watchers.tracker.ReleaseTracker(); this.m_Watched.Remove(dataWatchHandle.watched); } return; } } } } throw new ArgumentException("Data watch was not registered"); }