使用 SharpSVN 如何将文件导出到内存而不是文件系统?
所以我知道如何导出文件@文件系统的某些修订(因为导出的所有重载都有路径),但我不想为了便于访问而使用文件系统。有没有办法将其重定向到字符串或其他东西?谢谢。
So I know how to export files @ certain revisions to the filesystem (because all of the overloads for Export have paths in them) but I do not want to have to use the filesystem for ease of access purposes. Is there a way to redirect this to a string or something? Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用
SvnClient.Write()
来执行此操作这。例子:
You can use
SvnClient.Write()
to do this.Example:
我已纠正,但无法删除该帖子。
<罢工>
我查看了 SharpSVN 的源代码,它看起来不太有希望。该库没有使用 .NET 文件流写入文件系统(这可能让我们了解如何使用我们选择的 .NET 流),而是在执行命令时进行本机互操作。本机方法返回指示成功或失败的值,但似乎没有提供任何我们可以转换为
MemoryStream
或某些此类内存结构的句柄。我认为该问题最简单的解决方案是将修订导出到临时文件存储,然后使用 System.IO 类将文件读入内存。
I stand corrected, but cannot delete the post.
I took a look at the source code for SharpSVN, and it doesn't look promising. Instead of using .NET file streams for writing to the file system (which might have given us some insight how to use the .NET stream of our choice), the library does native interop when executing commands. The native methods return values indicating success or failure, but do not appear to provide handles to anything we can turn into a
MemoryStream
or some such in-memory structure.I think a least-effort solution to the problem is to export revisions to temporary file storage, then read the file(s) into memory with the
System.IO
classes.