Class Netrc
Represents data loaded from a .netrc file as a map from host names to credentials.
Namespace: NanoByte.Common.Net
Assembly: NanoByte.Common.dll
Syntax
public class Netrc : Dictionary<string, NetworkCredential>
Constructors
Netrc()
Declaration
public Netrc()
Properties
DefaultPath
The default path for the .netrc
file. Usually in the home directory. Can be overriden via NETRC
environment variable.
Declaration
public static string DefaultPath { get; }
Property Value
Type | Description |
---|---|
String |
Methods
Load(String)
Loads credentials from a .netrc file.
Declaration
public static Netrc Load(string path)
Parameters
Type | Name | Description |
---|---|---|
String | path | The path of the file to load. |
Returns
Type | Description |
---|---|
Netrc |
Exceptions
Type | Condition |
---|---|
IOException | A problem occurred while loading the file. |
UnauthorizedAccessException | Read access to the file was denied. |
LoadSafe()
Loads credentials from DefaultPath. Catches any exceptions and returns empty Netrc instead.
Declaration
public static Netrc LoadSafe()
Returns
Type | Description |
---|---|
Netrc |