Beispiel #1
0
 /// <summary>
 /// 相应接收成功消息
 /// </summary>
 /// <param name="msg"></param>
 /// <returns></returns>
 private async Task SendSuccess(string msg, int curLength = 0)
 {
     string result = new
     {
         status       = 1,
         newName      = _file.NewName,
         relativeName = _file.GetRelativeName(),
         curSize      = curSize,
         curLength    = curLength,
         msg          = msg
     }.ToJsonString();;
     ArraySegment <byte> data = new ArraySegment <byte>(Encoding.UTF8.GetBytes(result));
     await _socket.SendAsync(data, WebSocketMessageType.Text, true, CancellationToken.None);
 }
Beispiel #2
0
 /// <summary>
 /// 构造函数
 /// </summary>
 /// <param name="file"></param>
 public SuccessInfo(UploadInfo file)
 {
     this.newName = file.NewName;
     this.relativeName = file.GetRelativeName();
     this.size = file.ContentLength;
     this.Data = file.Data;
     this.handleType = file._UploadMsg.HandleType;
 }
Beispiel #3
0
 /// <summary>
 /// 详细构造信息
 /// </summary>
 /// <param name="file">文件信息</param>
 /// <param name="ex">错误信息</param>
 public ErrorInfo(UploadInfo file, Exception ex) : this(ex)
 {
     if (file != null)
     {
         this.newName      = file.NewName;
         this.relativeName = file.GetRelativeName();
     }
 }