示例#1
0
        private static void NimSignalingOptAcceptCallback(int code, IntPtr opt_res_param, IntPtr user_data)
        {
            NIMSignalingAcceptResParam accept_res_param = new NIMSignalingAcceptResParam();

            accept_res_param.info_ = new NIMSignalingChannelDetailedinfo();
            NIMSignalingJoinResParam_C res_param_c = (NIMSignalingJoinResParam_C)Marshal.PtrToStructure(opt_res_param, typeof(NIMSignalingJoinResParam_C));

            if (res_param_c != null)
            {
                accept_res_param.info_.channel_info_ = SignalHelper.NIMSignalingChannelInfoFromC(res_param_c.info_.channel_info_);
                for (int i = 0; i < res_param_c.info_.member_size_; i++)
                {
                    IntPtr src_data = NimUtility.IntPtrExtensions.Increment(res_param_c.info_.members_, i * Marshal.SizeOf(typeof(NIMSignalingMemberInfo_C)));
                    NIMSignalingMemberInfo_C member_info_c = (NIMSignalingMemberInfo_C)Marshal.PtrToStructure(src_data, typeof(NIMSignalingMemberInfo_C));
                    NIMSignalingMemberInfo   member_info   = SignalHelper.NIMSignalingMemberFromC(member_info_c);
                    accept_res_param.info_.members_.Add(member_info);
                }
            }

            NIMSignalingRejectOrAcceptResCode res_code = NIMSignalingRejectOrAcceptResCode.kUnknown;

            try
            {
                res_code = (NIMSignalingRejectOrAcceptResCode)Enum.Parse(typeof(NIMSignalingRejectOrAcceptResCode), code.ToString());
            }
            catch
            {
                res_code = NIMSignalingRejectOrAcceptResCode.kUnknown;
            }
            NimUtility.DelegateConverter.Invoke <NimSignalingOptAcceptHandler>(user_data, res_code, accept_res_param);
        }
示例#2
0
        private static void NimSignalingOptJoinCallback(int code, IntPtr opt_res_param, IntPtr user_data)
        {
            NIMSignalingJoinResParam res_param = new NIMSignalingJoinResParam();

            NIMSignalingJoinResParam_C res_param_c = (NIMSignalingJoinResParam_C)Marshal.PtrToStructure(opt_res_param, typeof(NIMSignalingJoinResParam_C));

            res_param.info_.channel_info_ = SignalHelper.NIMSignalingChannelInfoFromC(res_param_c.info_.channel_info_);
            for (int i = 0; i < res_param_c.info_.member_size_; i++)
            {
                IntPtr src_data = NimUtility.IntPtrExtensions.Increment(res_param_c.info_.members_, i * Marshal.SizeOf(typeof(NIMSignalingMemberInfo_C)));
                NIMSignalingMemberInfo_C member_info_c = (NIMSignalingMemberInfo_C)Marshal.PtrToStructure(src_data, typeof(NIMSignalingMemberInfo_C));
                NIMSignalingMemberInfo   member_info   = SignalHelper.NIMSignalingMemberFromC(member_info_c);
                res_param.info_.members_.Add(member_info);
            }

            NimUtility.DelegateConverter.Invoke <NimSignalingOptJoinHandler>(user_data, code, res_param);
        }