public void Release(Uid o, int uid) { if (uid == 0) return; lock (Lock) { RegisteredObjects.Remove(uid); FreeUidList.Enqueue(uid); } }
public int RegisterObject(Uid o) { lock (Lock) { int uid = FreeUidList.Count > 0 ? FreeUidList.Dequeue() : NextUid++; RegisteredObjects.Add(uid, o); return uid; } }
protected void WriteUid(BinaryWriter writer, Uid uid) { if (uid == null) { writer.Write(0L); return; } writer.Write(uid.UID); writer.Write(UidFactory.GetFamily(uid).GetHashCode()); }