Show / Hide Table of Contents

Class Netrc

Represents data loaded from a .netrc file as a map from host names to credentials.

Inheritance
Object
Netrc
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

Extension Methods

UpdateUtils.To<TIn, TOut>(TIn, Func<TIn, TOut>)
JsonStorage.SaveJson<T>(T, Stream)
JsonStorage.SaveJson<T>(T, String)
JsonStorage.ToJsonString<T>(T)
JsonStorage.ReparseAsJson<T>(Object)
JsonStorage.ReparseAsJson<T>(Object, T)
XmlStorage.SaveXml(Object, Stream, String)
XmlStorage.SaveXml<T>(T, String, String)
XmlStorage.ToXmlString(Object, String)
ConversionUtils.ConvertToString<TType>(TType)
In This Article
Back to top Copyright Bastian Eicher