Working C# Example: Writing & Reading NTFS Alternate Data Stream Under Win7 64 bit

依然范特西╮ 提交于 2019-12-03 13:20:53

I've had success on Windows 7 x64 using this library:

https://github.com/hubkey/Trinet.Core.IO.Ntfs

I can't find my old code, and the documentation page I have bookmarked is down at the moment, so I'll try to post some code when it's back up if you're still having problems.

Edit: Apparently it's as simple as:

using Trinet.Core.IO.Ntfs;

var fileInfo = new FileInfo(@"C:\path\to\file.dat");
if (AlternateDataStreamExists("MyStreamName"))
{
    var alternateStream = fileInfo.GetAlternateDataStream("MyStreamName").OpenRead();
}
else
{
    var alternateStream = fileInfo.GetAlternateDataStream("MyStreamName").OpenWrite();
}

You can also try my Platform.VirtualFileSystem library which supports listing, reading and writing NTFS alternate data streams in just a few lines of code.

https://github.com/platformdotnet/Platform.VirtualFileSystem/wiki https://github.com/platformdotnet/Platform.VirtualFileSystem/wiki/Alternate-Data-Streams

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!