Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sebastiandevelops/shareddriveconnection
This is the repository for the NuGet package called SharedDriveConnection. This package is used to connect to a shared network drive with credentails.
https://github.com/sebastiandevelops/shareddriveconnection
nuget nuget-package shared-drives
Last synced: 17 days ago
JSON representation
This is the repository for the NuGet package called SharedDriveConnection. This package is used to connect to a shared network drive with credentails.
- Host: GitHub
- URL: https://github.com/sebastiandevelops/shareddriveconnection
- Owner: SebastianDevelops
- Created: 2024-01-24T20:41:05.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2024-01-24T21:44:29.000Z (about 1 year ago)
- Last Synced: 2024-11-17T15:13:12.898Z (3 months ago)
- Topics: nuget, nuget-package, shared-drives
- Language: C#
- Homepage: https://www.nuget.org/packages/SharedDriveConnection/
- Size: 9.77 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readMe.md
Awesome Lists containing this project
README
# SharedDriveConnection NuGet Package
**SharedDriveConnection** is a simple .NET library that facilitates connecting to a network share with authentication. This library provides a `DriveConnect` class, allowing users to establish and manage network connections effortlessly.
## Getting Started
### Installation
To use this library, you can install it via NuGet Package Manager Console:
```bash
Install-Package SharedDriveConnection
```### Usage
1. **Initialize DriveConnect:**
```csharp
using SharedDriveConnection;
``````csharp
// Specify the network share path and credentials
string networkPath = "\\server\\share";
NetworkCredential credentials = new NetworkCredential("username", "password");// Create an instance of DriveConnect
using (DriveConnect driveConnect = new DriveConnect(networkPath, credentials))
{
// Your code here
}
```2. **Dispose of the Connection:**
The connection will be automatically disposed of when leaving the `using` block. However, you can manually dispose of it using the `Dispose` method:
```csharp
driveConnect.Dispose();
```## Documentation
### DriveConnect Class
#### Constructors
- `DriveConnect(string networkName, NetworkCredential credentials)`: Initializes a new instance of the `DriveConnect` class.
#### Events
- `Disposed`: Occurs when the instance has been disposed.
#### Methods
- `Dispose()`: Performs tasks associated with freeing, releasing, or resetting unmanaged resources.
#### Objects needed for Win32 functions
- `NetResource`: Represents details of the proposed connection.
- `ResourceScope`: Enumerates the resource scope.
- `ResourceType`: Enumerates the resource type.
- `ResourceDisplaytype`: Enumerates the resource display type.## Example
```csharp
using SharedDriveConnection;// Specify the network share path and credentials
string networkPath = "\\server\\share";
NetworkCredential credentials = new NetworkCredential("username", "password");// Create an instance of DriveConnect
using (DriveConnect driveConnect = new DriveConnect(networkPath, credentials))
{
// Your code here
}
```For more details on the Win32 functions used, refer to the [Microsoft documentation](http://msdn.microsoft.com/en-us/library/aa385413%28VS.85%29.aspx).
## Contributions
Contributions are welcome! Feel free to submit issues or pull requests.
## License
This library is licensed under the [MIT License](LICENSE).