You might see that the Dropbox Community team have been busy working on some major updates to the Community itself! So, here is some info on what’s changed, what’s staying the same and what you can expect from the Dropbox Community overall.
Forum Discussion
Nickk888
7 years agoExplorer | Level 3
.NET C# - Check and download/Sync missing files with local files
Hello everyone! I'm stuck for 2 days now with the API... I'm creating a game launcher where i need to download(sync), all the files for the game Client from Dropbox to the User. My goal is to c...
- 7 years ago
[Cross-linking for reference: https://stackoverflow.com/questions/52625933/net-c-sharp-check-and-download-sync-missing-files-with-local-files-using-drop ]
"use the file size as a reference?"
I do not recommend using size, as that can result in false positives. That is, two files can have the same size but different contents.
"How can i check if a specific file has been modified in the dropbox directory comparing it with the local files(If it hjas been downloaded before)?"
One way to do this would be to record which "rev" you downloaded, that is, the FileMetadata.Rev, included with the file download. When you check again later (e.g., from GetMetadata or ListFolder[Continue]), if the rev hasn't changed, you know you still have the latest copy. If the rev has changed, the file data may have changed.
Alternatively, you can check the FileMetadata.ContentHash. That can directly indicate if you have the same file data. You can find information on how that works here.
"How can i download the file asynchronously to the same local folder?"You can use the DownloadAsync method to download files, as seen in the examples here and here. What you do with the file data is up to you. For instance, unlike those examples, it sounds like you want to save the data to the local filesystem.
"How can i implement a progress bar showing the file name AND the progress in percent(0-100)?"The Dropbox API v2 .NET SDK does not offer progress listeners, but I'll be sure to pass this along as feedback. You can track progress from the download stream itself though as shown in this thread.
mikesam
Explorer | Level 4
Hi Здравко
Thanks for your reply.
I'm stucking at the examples, seems that examples no longer work.
And some of the page/link of reply from Greg was broken.
Best Regards,
Mike
Greg-DB
3 years agoDropbox Staff
mikesam My first post in this thread was from several years ago, so some things may have changed since then. You can find the latest resources for the .NET SDK here.
If something isn't working as expected, please share the details, such as the steps you're following and the code you're running, so we can take a look.
- Nickk8883 years agoExplorer | Level 3Hello everyone.
To answer the question mikesam gave, my Game launcher works, yes, BUT! I'm currently not using any API. I am just downloading the whole game from my VPS packed in a ZIP file, though it's not ideal, it works...
For the files: I'm checking the SHA-256 Hash of the games directory, checking if it matches the hash on the VPS, if not, delete game and unpack again. It's a bit of a "messy" practice, but it gets the Job done somehow. Though I would love to use an API as easy as Dropbox to make it properly, but I can't find any solution to make an App securely download files for other untrusted users without a Token like a game launcher simmilar to Steam, even if used non-commercially.
I could make my own API that downloads and somehow syncs files from my Virtual Private Server, but, why reinvent the wheel?...
Maybe Dropbox will add something like that in the future, maybe it's not allowed or not intended for that case, maybe wait for a different API, or maybe learn C# like a Pro and make an API yourself...
About Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.
5,910 PostsLatest Activity: 3 days agoIf you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X or Facebook.
For more info on available support options for your Dropbox plan, see this article.
If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!