Example #1
0
        /// <summary>
        ///下载资源(扩展)
        /// </summary>
        /// <param name="url">下载资源的URL</param>
        /// <param name="param">http 扩展参数</param>
        /// <param name="resCb">下载结果的回调函数</param>
        /// <param name="resData">下载结果回调自定义用户数据,</param>
        /// <param name="prgCb">下载进度的回调函数</param>
        /// <param name="prgData">进度回调自定义用户数据</param>
        /// <param name="speedCb">下载速度的回调函数</param>
        /// <param name="speedData">下载速度回调自定义用户数据</param>
        /// <param name="infoCb">返回最终下载信息的回调函数</param>
        /// <param name="infoData">下载信息回调的自定义用户数据</param>
        public static void DownloadEx(string url,
                                      HttpExtendedParameters param,
                                      DownloadCb resCb, IntPtr resData,
                                      DownloadPrgCb prgCb, IntPtr prgData,
                                      DownloadSpeedCb speedCb, IntPtr speedData,
                                      DownloadInfoCb infoCb, IntPtr infoData)
        {
            CallbackDataPair resPair   = new CallbackDataPair(resCb, resData);
            CallbackDataPair prgPair   = new CallbackDataPair(prgCb, prgData);
            CallbackDataPair speedPair = new CallbackDataPair(speedCb, speedData);
            CallbackDataPair infoPair  = new CallbackDataPair(infoCb, infoData);

            NosNativeMethods.nim_nos_download_ex(url,
                                                 param != null ? param.Serialize() : string.Empty,
                                                 DownloadResultCallbackEx, resPair.ToIntPtr(),
                                                 DownloadPrgCallbackEx, prgPair.ToIntPtr(),
                                                 DownloadSpeedCallbackEx, speedPair.ToIntPtr(),
                                                 DownloadInfoCallbackEx, infoPair.ToIntPtr());
        }
Example #2
0
        /// <summary>
        /// 获取资源(扩展)
        /// </summary>
        /// <param name="msg">包含附件的消息体</param>
        ///<param name="param">下载扩展信息</param>
        /// <param name="resCb"></param>
        /// <param name="resData"></param>
        /// <param name="prgCb"></param>
        /// <param name="prgData"></param>
        /// <param name="speedCb"></param>
        /// <param name="speedData"></param>
        /// <param name="infoCb"></param>
        /// <param name="infoData"></param>
        public static void DownloadMediaEx(NIMIMMessage msg,
                                           HttpExtendedParameters param,
                                           DownloadCb resCb, IntPtr resData,
                                           DownloadPrgCb prgCb, IntPtr prgData,
                                           DownloadSpeedCb speedCb, IntPtr speedData,
                                           DownloadInfoCb infoCb, IntPtr infoData)
        {
            var msgJson = msg.Serialize();
            CallbackDataPair resPair   = new CallbackDataPair(resCb, resData);
            CallbackDataPair prgPair   = new CallbackDataPair(prgCb, prgData);
            CallbackDataPair speedPair = new CallbackDataPair(speedCb, speedData);
            CallbackDataPair infoPair  = new CallbackDataPair(infoCb, infoData);

            NosNativeMethods.nim_nos_download_media_ex(msgJson,
                                                       param == null ? null : param.Serialize(),
                                                       DownloadResultCallbackEx, resPair.ToIntPtr(),
                                                       DownloadPrgCallbackEx, prgPair.ToIntPtr(),
                                                       DownloadSpeedCallbackEx, speedPair.ToIntPtr(),
                                                       DownloadInfoCallbackEx, infoPair.ToIntPtr());
        }
Example #3
0
        /// <summary>
        /// 上传资源(扩展)
        /// </summary>
        /// <param name="localFile">本地文件的完整路径</param>
        /// <param name="tag">场景标签,主要用于确定文件的保存时间</param>
        /// <param name="param">参数配置</param>
        /// <param name="resCb">上传的回调函数</param>
        /// <param name="resData">APP的自定义用户数据,SDK只负责传回给回调函数resCb,不做任何处理!</param>
        /// <param name="prgCb">上传进度的回调函数</param>
        /// <param name="prgData">APP的自定义用户数据,SDK只负责传回给回调函数prgCb,不做任何处理!</param>
        /// <param name="speedCb">上传速度的回调函数</param>
        /// <param name="speedData">peed_user_data APP的自定义用户数据,SDK只负责传回给回调函数speedCb,不做任何处理!</param>
        /// <param name="infoCb">info_cb 返回最终上传信息的回调函数</param>
        /// <param name="infoData"> APP的自定义用户数据,SDK只负责传回给回调函数infoCb,不做任何处理!</param>
        public static void UploadEx2(string localFile,
                                     string tag,
                                     HttpExtendedParameters param,
                                     UploadCb resCb, IntPtr resData,
                                     UploadPrgCb prgCb, IntPtr prgData,
                                     UploadSpeedCb speedCb, IntPtr speedData,
                                     UploadInfoCb infoCb, IntPtr infoData)
        {
            CallbackDataPair resPair   = new CallbackDataPair(resCb, resData);
            CallbackDataPair prgPair   = new CallbackDataPair(prgCb, prgData);
            CallbackDataPair speedPair = new CallbackDataPair(speedCb, speedData);
            CallbackDataPair infoPair  = new CallbackDataPair(infoCb, infoData);

            NosNativeMethods.nim_nos_upload_ex2(localFile, tag,
                                                param != null ? param.Serialize() : string.Empty,
                                                UploadCallbackEx, resPair.ToIntPtr(),
                                                UploadPrgCallbackEx, prgPair.ToIntPtr(),
                                                UploadSpeedCallbackEx, speedPair.ToIntPtr(),
                                                UploadInfoCallbackEx, infoPair.ToIntPtr());
        }