Skip to content

moodl/SimpleShareLibrary

Repository files navigation

SimpleShareLibrary

NuGet

A simplified, protocol-agnostic .NET Standard 2.0 wrapper for remote file share operations. Currently supports SMB via SMBLibrary by Tal Aloni.

Why?

SMBLibrary is a powerful, pure .NET SMB client/server implementation supporting SMB 1.0 through 3.1.1. However, its low-level API requires significant boilerplate for common operations. SimpleShareLibrary provides an easy-to-use API for everyday file operations on remote shares.

Before (SMBLibrary):

SMB2Client client = new SMB2Client(); bool isConnected = client.Connect(IPAddress.Parse("192.168.1.11"), SMBTransportType.DirectTCPTransport); if (isConnected) { NTStatus status = client.Login(String.Empty, "user", "pass"); if (status == NTStatus.STATUS_SUCCESS) { ISMBFileStore fileStore = client.TreeConnect("Share", out status); if (status == NTStatus.STATUS_SUCCESS) { object fileHandle; FileStatus fileStatus; status = fileStore.CreateFile(out fileHandle, out fileStatus, "file.txt", AccessMask.GENERIC_READ | AccessMask.SYNCHRONIZE, FileAttributes.Normal, ShareAccess.Read, CreateDisposition.FILE_OPEN, CreateOptions.FILE_NON_DIRECTORY_FILE | CreateOptions.FILE_SYNCHRONOUS_IO_ALERT, null); // ... read loop, close, disconnect, logoff ... } } }

After (SimpleShareLibrary):

using (var smb = new SmbClient("192.168.1.11", "Share", "user", "pass")) { byte[] data = smb.ReadFile("file.txt"); }

Documentation

See the docs/ directory for detailed documentation:

Installation

dotnet add package SimpleShareLibrary 

Contributing

Contributions are welcome! The library is designed with a protocol-agnostic provider model — IShareClientFactory, IShareClient, and IShare are generic interfaces that any file sharing protocol can implement. Currently only SMB is supported, but adding providers for other protocols (NFS, SFTP, WebDAV, etc.) is straightforward.

See docs/contributing.md for details on how to get started.

License

This project is licensed under the MIT License.

Third-Party Dependencies

This library uses SMBLibrary by Tal Aloni (@TalAloni) as a runtime NuGet dependency, licensed under LGPL-3.0-or-later. SMBLibrary is not embedded or merged into this assembly — it remains a separate, replaceable component as required by the LGPL.

All core SMB protocol implementation credit belongs to Tal Aloni and the SMBLibrary contributors.

Disclaimer

This project is not affiliated with, endorsed by, or sponsored by Tal Aloni or the SMBLibrary project.

This software is provided "as is", without warranty of any kind. See DISCLAIMER.md for full details (English and German).

Acknowledgments

Built on top of SMBLibrary — a powerful, pure .NET SMB client/server implementation. Without SMBLibrary, this project would not exist.

About

A simplified, protocol-agnostic .NET Standard 2.0 wrapper for remote file share operations

Resources

License

Contributing

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages