Beispiel #1
0
        void SetNotificationBaseInfo(IntPtr ptr)
        {
            var notification = NimUtility.Utilities.IntPtrToStructure <CNotification>(ptr);
            var notifyData   = NimUtility.Utilities.IntPtrToStructure <CNotificationData>(notification.Data);

            custom_info_     = NimUtility.Utilities.MarshalUtf8String(notifyData.custom_info_);
            from_account_id_ = NimUtility.Utilities.MarshalUtf8String(notifyData.from_account_id_);
            msg_id_          = notifyData.msg_id_;
            var cChannel = NimUtility.Utilities.IntPtrToStructure <NIMSignalingChannelInfo_C>(notifyData.channel_info_);

            channel_info_ = SignalHelper.NIMSignalingChannelInfoFromC(cChannel);
        }
        public void SetData(IntPtr ptr)
        {
            if (ptr == IntPtr.Zero)
            {
                return;
            }
            ChannelDetail             channelDetail = (ChannelDetail)Marshal.PtrToStructure(ptr, typeof(ChannelDetail));
            NIMSignalingChannelInfo_C channel       = (NIMSignalingChannelInfo_C)Marshal.PtrToStructure(channelDetail.Channel, typeof(NIMSignalingChannelInfo_C));

            channel_info_ = SignalHelper.NIMSignalingChannelInfoFromC(channel);
            if (channelDetail.MembersCount > 0)
            {
                for (int i = 0; i < channelDetail.MembersCount; i++)
                {
                    var memberPtr = Marshal.ReadIntPtr(channelDetail.Members, i * Marshal.SizeOf(typeof(IntPtr)));
                    var member    = (NIMSignalingMemberInfo)Marshal.PtrToStructure(memberPtr, typeof(NIMSignalingMemberInfo));
                    members_.Add(member);
                }
            }
        }