コード例 #1
0
        /// <summary>
        /// 接收成功 相应
        /// </summary>
        /// <param name="msg"></param>
        public void SendSuccess(string msg)
        {
            _Context.Response.ContentType = "application/json";
            string result = new SuccessInfo(this, msg).ToJsonString();

            byte[] data = UTF8Encoding.Default.GetBytes(result);
            _Context.Response.Body.Write(data, 0, data.Length);
        }
コード例 #2
0
        /// <summary>
        /// 相应接收成功消息
        /// </summary>
        /// <param name="msg"></param>
        /// <returns></returns>
        private async Task SendSuccess(string msg, int curLength = 0)
        {
            SuccessInfo result = new SuccessInfo(_file);

            result.curSize   = curSize;
            result.curLength = curLength;
            result.msg       = msg;
            ArraySegment <byte> data = new ArraySegment <byte>(Encoding.UTF8.GetBytes(result.ToJson()));
            await _socket.SendAsync(data, WebSocketMessageType.Text, true, CancellationToken.None);
        }
コード例 #3
0
ファイル: FormReceiver.cs プロジェクト: tianma3798/Uploader
        /// <summary>
        /// 接收成功 相应
        /// </summary>
        /// <param name="msg"></param>
        public void SendSuccess(string msg)
        {
            _Context.Response.ContentType = "application/json";
            SuccessInfo result = new SuccessInfo(this, msg);

            if (OnSuccess != null)
            {
                OnSuccess(result);
            }
            byte[] data = UTF8Encoding.Default.GetBytes(result.ToJson());
            _Context.Response.Body.WriteAsync(data, 0, data.Length);
        }