您将使用什么语言在记忆棒上实现自动更新/同步功能?
我们需要通过 USB 密钥将文档分发给我们的合作伙伴。我被要求开发一款软件,用于检查服务器上的某些文档是否已更新,并继续同步记忆棒上的文件。
软件本身还需要具有自动更新功能,以便我们将来想要改进它。
你们认为我应该从哪里开始?
We need to distribute documents to our partners on a USB key. I've been asked to develop a piece of software that will check if some documents have been updated on the server and proceed with the synchronization of files on the memory stick.
The software itself will also need to have an auto-update functionality in case we want to improve it in the future.
Where do you guys think I should start?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
我假设这是针对 Windows 的。 C# 将是一个很好的选择,除非您无法确定用户是否已经安装了 .Net。否则我会使用 Delphi,它可以轻松创建本机可执行文件。无论您使用什么语言,自动更新功能都会很痛苦,因为正在运行的 EXE 文件无法替换自身。您可以将程序的大部分功能实现为一个单独的 DLL,该 DLL 可以动态更新,但如果您需要更新核心 EXE 本身,您仍然可以解决问题。
I'm assuming this is for Windows. C# would be an excellent choice, unless you can't be sure the user already has .Net installed. Otherwise I'd use Delphi, which can create native executables easily. The auto-update feature will be a pain no matter what language you use, given that a running EXE file can't replace itself. You can implement most of the program's functionality as a separate DLL which can be updated on the fly, but you're still SOL if you need to update the core EXE itself.
我建议Python...你可以使其可执行或将其安装在USB本身上(它不大)。一个很大的优点是您可以当场改进它,因为您不需要重新编译。 Python 非常适合此类小任务。
一个很大的优势是平台独立性。
I would suggest Python... you can make its executable or install it on usb itself(its not big). A big advantage you can improve it on the spot as you wont need recompilation. Python is great for such small tasks.
A big advantage is platform independence.
嗯,这显然取决于您要部署的环境以及您个人使用过的环境。我立刻倾向于 C#,因为它有很多文档,并且允许您使用 gui 快速部署 Windows 应用程序。
然而,如果这是一个 Unix 环境,我确信这可以通过一个简单的 shell 脚本来完成。
Well it depends on the environment you are deploying to obviously, and what you personally have worked with. Off the bat I would be leaning towards C#, as there is a lot of documentation and will allow you to rapidly deploy a windows app with gui.
However if this is a Unix environment I sure this could be done in a simple shell script.
无论您最熟悉和最熟练的语言是什么,只要它有一种与服务器通信的简单方法即可。 (如果服务器是网络服务器,那可能不是问题)
Whatever language you're most comfortable in and most skilled at, as long as it has an easy way to communicate with the server. (If the server is a web server, that's probably not an issue)
我会研究Microsoft Sync Framework。请参阅“文件同步简介”部分。 “...使用同步框架在桌面和设备之间高效地移动文件。”
我在一个项目中使用了“Sync Services for ADO.Net”(框架的一部分)来同步本地 SQL Express 数据库与主 SQL Server 数据库,它节省了我大量的时间。
I would look into Microsoft Sync Framework. Look at the section "Introduction to File Synchronization." "...use the Sync Framework to efficiently move files between desktops and devices."
I used "Sync Services for ADO.Net" (part of the Framework) for a project to sync a local SQL Express database with the main SQL Server database and it saved me a ton of time.
Cygwin 中存在适用于 Windows 的 Rsync - 如果您的服务器支持 ssh,它还支持带有公钥基础设施的 ssh。
这可能是一种非常安全且简单的数据同步方法。
Rsync exists for Windows in Cygwin - it also supports ssh with a public key infrastructure if your server supports ssh.
This could be a very secure and easy way to synchronize data.
假设这是 Windows,我将从 USB 设备上的这个批处理文件开始:
xcopy /diyc 。 $ServerPath
也许这就足够了?
标志的解释:
Assuming this is Windows, I would start with this batch file on the USB device:
xcopy /diyc . $ServerPath
Perhaps that is enough?
Explanation on the flags:
一个批处理文件就足够了。我已经用一个简单的解决了类似的问题。另一种选择是 AutoIt 中的脚本,它是一种基本的类似语言,可以创建几乎没有依赖项的小型“编译”程序。您只需将可执行文件复制到 USB 设备并从那里运行它。
A batch file could be enough. I have solved something similar with a simple one. Another option would be a script in AutoIt, its a basic like language which can create small "compiled" programs with almost no dependencies. You just copy the executable to the USB devices and run it from there.