コード例 #1
0
        /// <summary>
        /// 本地查询群信息(同步版本,堵塞NIM内部线程,谨慎使用)
        /// </summary>
        /// <param name="tid"></param>
        /// <returns></returns>
        public static NIMTeamInfo QueryCachedTeamInfo(string tid)
        {
            var ptr = TeamNativeMethods.nim_team_query_team_info_block(tid);

            if (ptr != IntPtr.Zero)
            {
                NimUtility.Utf8StringMarshaler marshaler = new NimUtility.Utf8StringMarshaler();
                var tobj  = marshaler.MarshalNativeToManaged(ptr);
                var tinfo = NIMTeamInfo.Deserialize(tobj.ToString());
                GlobalAPI.FreeStringBuffer(ptr);
                return(tinfo);
            }
            return(null);
        }
コード例 #2
0
        /// <summary>
        /// 查询(单个)群成员信息(同步版本,堵塞NIM内部线程,谨慎使用)
        /// </summary>
        /// <param name="tid"></param>
        /// <param name="uid"></param>
        /// <returns></returns>
        public static NIMTeamMemberInfo QuerySingleMemberInfo(string tid, string uid)
        {
            NIMTeamMemberInfo info = null;
            var ptr = TeamNativeMethods.nim_team_query_team_member_block(tid, uid);

            if (ptr != IntPtr.Zero)
            {
                NimUtility.Utf8StringMarshaler marshaler = new NimUtility.Utf8StringMarshaler();
                var infoObj = marshaler.MarshalNativeToManaged(ptr);
                info = NIMTeamMemberInfo.Deserialize(infoObj.ToString());
                GlobalAPI.FreeStringBuffer(ptr);
            }
            return(info);
        }