Ejemplo n.º 1
0
        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));
        }
Ejemplo n.º 2
0
 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;
         }
     }
 }
Ejemplo n.º 3
0
        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);
        }