|
|
@@ -26,13 +26,15 @@ namespace BPASmartClient.IoT.Model |
|
|
|
{ |
|
|
|
return UploadData.ContainsKey(key) ? UploadData[key] : string.Empty; |
|
|
|
} |
|
|
|
public static long length = 0; |
|
|
|
public static byte[] FileBlock; |
|
|
|
/// <summary> |
|
|
|
/// 文件请求上传 |
|
|
|
/// </summary> |
|
|
|
public static void FileRequest(DataVReport dataV) |
|
|
|
{ |
|
|
|
long length = new FileInfo(path).Length; |
|
|
|
byte[] FileBlock = FileContent(path); |
|
|
|
FileBlock = FileContent(path); |
|
|
|
length = FileBlock.Count(); |
|
|
|
FileUploadModel fileUpload = new FileUploadModel(); |
|
|
|
fileUpload.@params.fileName = FileName; |
|
|
|
fileUpload.@params.fileSize = length; |
|
|
@@ -58,7 +60,6 @@ namespace BPASmartClient.IoT.Model |
|
|
|
/// </summary> |
|
|
|
public static void FileSend(DataVReport dataV, string uploadId) |
|
|
|
{ |
|
|
|
long length = new FileInfo(path).Length; |
|
|
|
FileSendModel fileSend = new FileSendModel(); |
|
|
|
fileSend.@params.uploadId = uploadId; |
|
|
|
fileSend.@params.offset = 0; |
|
|
@@ -68,7 +69,6 @@ namespace BPASmartClient.IoT.Model |
|
|
|
byte[] Header = Encoding.UTF8.GetBytes(Tools.JsonConvertTools(fileSend)); |
|
|
|
byte HeaderLen_L = (byte)(Header.Length); |
|
|
|
byte HeaderLen_H = (byte)(Header.Length >> 8); |
|
|
|
byte[] FileBlock = FileContent(path); |
|
|
|
byte[] CRC16 = CRC16Standard.getCRCBytes(FileBlock);//CRC.CRC16(FileBlock); |
|
|
|
List<byte> message = new List<byte>() { HeaderLen_H, HeaderLen_L }; |
|
|
|
message.AddRange(Header); |
|
|
|