gpt4 book ai didi

c# - 使用 DropBox api 时的进度条

转载 作者:行者123 更新时间:2023-11-30 13:05:22 27 4
gpt4 key购买 nike

使用 Dropnet(保管箱 API)。我可以上传这样的文件:

        DropNet.DropNetClient dc = new DropNet.DropNetClient("*************", "g86p9959v9tvg49");
dc.Login("jain@gmail.com", "********");
byte[] rawData = File.ReadAllBytes("Ionic.Zip.dll");
dc.UploadFile("Public", "Ionic.Zip.dll",rawData );
Console.WriteLine(dc.Account_Info().quota_info.quota/(1024*1024));

有没有办法用这个来设置进度条? It says here:

Its something you can work outyourself - you know how big the filesare, you know how much you have sentor received so far, the rest is basicmath. :)

我如何计算出发送了多少数据?有什么帮助吗?

谢谢

编辑:上传方法返回 - DropNet.Models.DropNetResult.statuscode 一个 System.net.httpstatuscode 对象。是这个吗 ?我必须以某种方式使用这个东西来制作进度条吗?

最佳答案

我认为不可能查看 their source code在 git-hub 上,因为没有任何反馈。有一个 UploadFileAsync()除了在完成时调用的回调操作外,它还采用与 UploadFile() 相同的参数。您可以使用异步方法来显示选取框样式的进度条并清理回调操作。

我不确定这是否可行,但您可以在上传前捕获 quota_info 并开始异步上传并定期监控 quota_info。如果 quota_info 在文件上传时更新,那么您就知道文件的大小以及已上传的文件量,您应该能够计算得出。

关于c# - 使用 DropBox api 时的进度条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5219735/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com