BookSleeve.RedisResult.IsMatch C# (CSharp) Méthode

IsMatch() public méthode

public IsMatch ( byte expected ) : bool
expected byte
Résultat bool
        public bool IsMatch(byte[] expected)
        {
            var bytes = ValueBytes;
            if (expected == null && bytes == null) return true;
            if (expected == null || bytes == null || expected.Length != bytes.Length) return false;
            for (int i = 0; i < bytes.Length; i++)
                if (expected[i] != bytes[i]) return false;
            return true;
        }

Usage Example

Exemple #1
0
        internal override void ProcessCallbacks(object ctx, RedisResult result)
        {
            RedisResult[] subItems;
            if (!result.IsError && (subItems = result.ValueItems) != null)
            {
                switch (subItems.Length)
                {
                case 3:
                    RedisResult msgType = subItems[0];
                    if (msgType.IsMatch(message))
                    {
                        string key = subItems[1].ValueString;
                        OnMessageReceived(key, key, subItems[2]);
                    }
                    else if (msgType.IsMatch(subscribe) || msgType.IsMatch(unsubscribe) ||
                             msgType.IsMatch(psubscribe) || msgType.IsMatch(punsubscribe))
                    {
                        var newCount = (int)subItems[2].ValueInt64;
                        Interlocked.Exchange(ref subscriptionCount, newCount);
                    }
                    break;

                case 4:
                    if (subItems[0].IsMatch(pmessage))
                    {
                        OnMessageReceived(subItems[1].ValueString, subItems[2].ValueString, subItems[3]);
                    }
                    break;
                }
            }
        }
All Usage Examples Of BookSleeve.RedisResult::IsMatch