public unsafe bool TryGetValueFromBytes(byte *ptr, int byteCount, out OscActionPair value) { var debugBlobStr = new BlobString(ptr, byteCount); debugBlobStr.Dispose(); return(HandleToValue.TryGetValue(new BlobHandle(ptr, byteCount), out value)); }
public void Add(string address, OscActionPair callbacks) { if (!SourceToBlob.TryGetValue(address, out var blobStr)) { blobStr = new BlobString(address); HandleToValue[blobStr.Handle] = callbacks; SourceToBlob.Add(address, blobStr); } else { if (HandleToValue.ContainsKey(blobStr.Handle)) { HandleToValue[blobStr.Handle] += callbacks; } else { HandleToValue[blobStr.Handle] = callbacks; } } }
public bool Remove(string address, OscActionPair callbacks) { if (!SourceToBlob.TryGetValue(address, out var blobStr)) { return(false); } if (!HandleToValue.TryGetValue(blobStr.Handle, out var existingPair)) { return(false); } var valueReadMethod = existingPair.ValueRead; if (valueReadMethod.GetInvocationList().Length == 1) { var removed = HandleToValue.Remove(blobStr.Handle) && SourceToBlob.Remove(address); blobStr.Dispose(); return(removed); } HandleToValue[blobStr.Handle] -= callbacks; return(true); }