Esempio n. 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);
                 }
             });
         }
     }
 }
Esempio n. 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);
                 }
             });
         }
     }
 }