示例#1
0
        public void UploadFile(bool isResent)
        {
            byte[] dataToSend;

            if (isResent)
            {
                dataToSend = LastFilePackage.GetCompletePackage();
            }
            else
            {
                byte[] filePackageData = GetDataArray(FileStream);
                LastFilePackage = new FilePackage(filePackageData);
                dataToSend      = LastFilePackage.GetCompletePackage();
            }

            string uploadAddress = UploadAddress + "&hash=" + LastFilePackage.SHA1CheckSumSize;

            uploadAddress += "&site=" + HttpUtility.UrlEncode(App.Params.SiteUrl);
            uploadAddress += "&fileUploadLibrary=" + HttpUtility.UrlEncode(App.Params.FileUploadLibrary);

            if (FileStream.Position >= (FileStream.Length - 1))
            {
                uploadAddress += "&position=last";
            }

            Uri uploadAddressUri = new Uri(uploadAddress);

            UploadClient.OpenWriteAsync(uploadAddressUri, null, dataToSend);
        }
示例#2
0
        public void UploadFile(bool isResent)
        {
            byte[] dataToSend;

            if (isResent)
            {
                dataToSend = LastFilePackage.GetCompletePackage();
            }
            else
            {
                byte[] filePackageData = GetDataArray(FileStream);
                LastFilePackage = new FilePackage(filePackageData);
                dataToSend = LastFilePackage.GetCompletePackage();
            }

            string uploadAddress = UploadAddress + "&hash=" + LastFilePackage.SHA1CheckSumSize;

            uploadAddress += "&site=" + HttpUtility.UrlEncode(App.Params.SiteUrl);
            uploadAddress += "&fileUploadLibrary=" + HttpUtility.UrlEncode(App.Params.FileUploadLibrary);

            if (FileStream.Position >= (FileStream.Length - 1))
            {
                uploadAddress += "&position=last";
            }

            Uri uploadAddressUri = new Uri(uploadAddress);

            UploadClient.OpenWriteAsync(uploadAddressUri, null, dataToSend);
        }