Пример #1
0
 private static void OnGetChannelAttributesResultCallback(int id, Int64 requestId, string attributes, int numberOfAttributes, ATTRIBUTE_OPERATION_ERR errorCode)
 {
     if (clientEventHandlerHandlerDic.ContainsKey(id) && clientEventHandlerHandlerDic[id].OnGetChannelAttributesResult != null)
     {
         if (AgoraCallbackObject.GetInstance()._CallbackQueue != null)
         {
             AgoraCallbackObject.GetInstance()._CallbackQueue.EnQueue(() => {
                 if (clientEventHandlerHandlerDic.ContainsKey(id) && clientEventHandlerHandlerDic[id].OnGetChannelAttributesResult != null)
                 {
                     int j           = 1;
                     string[] sArray = attributes.Split('\t');
                     RtmChannelAttribute [] channelAttributes = new RtmChannelAttribute[numberOfAttributes];
                     for (int i = 0; i < numberOfAttributes; i++)
                     {
                         RtmChannelAttribute _attribute = new RtmChannelAttribute(MESSAGE_FLAG.RECEIVE);
                         _attribute.SetKey(sArray[j++]);
                         _attribute.SetValue(sArray[j++]);
                         _attribute.SetLastUpdateTs(Int64.Parse(sArray[j++]));
                         _attribute.SetLastUpdateUserId(sArray[j++]);
                         channelAttributes[i] = _attribute;
                     }
                     clientEventHandlerHandlerDic[id].OnGetChannelAttributesResult(id, requestId, channelAttributes, numberOfAttributes, errorCode);
                 }
             });
         }
     }
 }
Пример #2
0
 private static void OnAttributesUpdatedCallback(int id, string attributesListPtr, int numberOfAttributes)
 {
     if (channelEventHandlerDic.ContainsKey(id) && channelEventHandlerDic[id].OnAttributesUpdated != null)
     {
         if (AgoraCallbackObject.GetInstance()._CallbackQueue != null)
         {
             AgoraCallbackObject.GetInstance()._CallbackQueue.EnQueue(() => {
                 if (channelEventHandlerDic.ContainsKey(id) && channelEventHandlerDic[id].OnAttributesUpdated != null)
                 {
                     int j           = 1;
                     string[] sArray = attributesListPtr.Split('\t');
                     RtmChannelAttribute [] channelAttributes = new RtmChannelAttribute[numberOfAttributes];
                     for (int i = 0; i < numberOfAttributes; i++)
                     {
                         RtmChannelAttribute _attribute = new RtmChannelAttribute(MESSAGE_FLAG.RECEIVE);
                         _attribute.SetKey(sArray[j++]);
                         _attribute.SetValue(sArray[j++]);
                         _attribute.SetLastUpdateTs(Int64.Parse(sArray[j++]));
                         _attribute.SetLastUpdateUserId(sArray[j++]);
                         channelAttributes[i] = _attribute;
                     }
                     channelEventHandlerDic[id].OnAttributesUpdated(id, channelAttributes, numberOfAttributes);
                 }
             });
         }
     }
 }
Пример #3
0
 public RtmChannelAttribute(RtmChannelAttribute channelAttribute, MESSAGE_FLAG flag)
 {
     _flag             = flag;
     _key              = channelAttribute.GetKey();
     _value            = channelAttribute.GetValue();
     _lastUpdateTs     = channelAttribute.GetLastUpdateTs();
     _lastUpdateUserId = channelAttribute.GetLastUpdateUserId();
 }
Пример #4
0
        /// <summary>
        /// Creates an <RtmChannelAttribute> instance.
        /// </summary>
        /// <returns>
        /// An <RtmChannelAttribute> instance.
        /// </returns>
        public RtmChannelAttribute CreateChannelAttribute()
        {
            if (_rtmServicePtr == IntPtr.Zero)
            {
                Debug.LogError("rtmServicePtr is null");
                return(null);
            }
            IntPtr channelAttribute       = createChannelAttribute(_rtmServicePtr);
            RtmChannelAttribute attribute = new RtmChannelAttribute(channelAttribute);

            attributeList.Add(attribute);
            return(attribute);
        }