C# 是否有任何使用 rsync 的 .NET API?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/999751/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is there any .NET API using rsync?
提问by devnull
I need to have a file synchronizing feature in my .NET application. Can I make use of rsync? Is there any API available?
我需要在我的 .NET 应用程序中有一个文件同步功能。我可以使用 rsync 吗?有没有可用的API?
采纳答案by Ron Klein
You can use the source code that comes with DeltaCopy, which is a "'Windows Friendly' wrapper" to the original RSync.
The source is written in c++, so it's not exactly .Net, but you can write managed C++ wrappers and use them.
It's not a direct solution, I know, but it may be somewhat helpful. (in other words, HTH)
您可以使用DeltaCopy附带的源代码,它是原始 RSync 的“'Windows 友好'包装器”。
源代码是用 C++ 编写的,因此它不完全是 .Net,但您可以编写托管 C++ 包装器并使用它们。
我知道这不是一个直接的解决方案,但它可能会有所帮助。(换句话说,HTH)
回答by Sam Saffron
If you are looking for some simple automation you could just write a tiny wrapper that invokes RSync via System.Diagnostic.Process
如果您正在寻找一些简单的自动化,您可以编写一个通过System.Diagnostic.Process调用 RSync 的小包装器
I did read somewhere that someone circa 2006 created an rsync port in C#, but to be honest with you I would not consider using it cause its far from popular and impossible to find.
我确实在某处读到有人在 2006 年左右在 C# 中创建了一个 rsync 端口,但老实说我不会考虑使用它,因为它远非流行且无法找到。
回答by Matthew Flaschen
DeltaCopy is just a wrapper around the rsync executable. However, librsync itself can be built on Windows as well as UNIX and GNU/Linux (see their READMEand this EE thread). Thus, that's another option to consider. You would still need some kind of unmanaged-managed interop.
DeltaCopy 只是 rsync 可执行文件的包装器。但是,librsync 本身可以在 Windows 以及 UNIX 和 GNU/Linux 上构建(请参阅它们的 README和这个EE 线程)。因此,这是另一个需要考虑的选择。您仍然需要某种非托管的互操作。
回答by Almond
There is a C# implementation of RSync on github with some recent commits:
github 上有一个 RSync 的 C# 实现,有一些最近的提交: