Neuron®
The Neuron® is the basis for the creation of open and secure federated networks for smart societies.
Loading...
Searching...
No Matches
Waher.Content.Resources Class Reference

Static class managing loading of resources stored as embedded resources or in content files. More...

Static Public Member Functions

static Assembly GetAssembly (string ResourceName)
 Gets the assembly corresponding to a given resource name. More...
 
static byte[] LoadResource (string ResourceName)
 Loads a resource from an embedded resource. More...
 
static byte[] LoadResource (string ResourceName, Assembly Assembly)
 Loads a resource from an embedded resource. More...
 
static string LoadResourceAsText (string ResourceName)
 Loads a text resource from an embedded resource. More...
 
static string LoadResourceAsText (string ResourceName, Assembly Assembly)
 Loads a text resource from an embedded resource. More...
 
static X509Certificate2 LoadCertificate (string ResourceName)
 Loads a certificate from an embedded resource. More...
 
static X509Certificate2 LoadCertificate (string ResourceName, Assembly Assembly)
 Loads a certificate from an embedded resource. More...
 
static X509Certificate2 LoadCertificate (string ResourceName, string Password)
 Loads a certificate from an embedded resource. More...
 
static X509Certificate2 LoadCertificate (string ResourceName, string Password, Assembly Assembly)
 Loads a certificate from an embedded resource. More...
 
static async Task< byte[]> ReadAllBytesAsync (string FileName)
 Reads a binary file asynchronously. More...
 
static async Task< string > ReadAllTextAsync (string FileName)
 Reads a text file asynchronously. More...
 
static Task WriteAllBytesAsync (string FileName, byte[] Data)
 Creates a binary file asynchronously. More...
 
static async Task WriteAllBytesAsync (string FileName, byte[] Data, int Offset, int Length)
 Creates a binary file asynchronously. More...
 
static Task AppendAllBytesAsync (string FileName, byte[] Data)
 Appends a binary file asynchronously. More...
 
static async Task AppendAllBytesAsync (string FileName, byte[] Data, int Offset, int Length)
 Appends a binary file asynchronously. More...
 
static Task WriteAllTextAsync (string FileName, string Text)
 Creates a text file asynchronously. More...
 
static async Task WriteAllTextAsync (string FileName, string Text, Encoding Encoding)
 Creates a text file asynchronously. More...
 

Detailed Description

Static class managing loading of resources stored as embedded resources or in content files.

Definition at line 14 of file Resources.cs.

Member Function Documentation

◆ AppendAllBytesAsync() [1/2]

static Task Waher.Content.Resources.AppendAllBytesAsync ( string  FileName,
byte[]  Data 
)
static

Appends a binary file asynchronously.

Parameters
FileNameFilename.
DataBinary data

Definition at line 241 of file Resources.cs.

◆ AppendAllBytesAsync() [2/2]

static async Task Waher.Content.Resources.AppendAllBytesAsync ( string  FileName,
byte[]  Data,
int  Offset,
int  Length 
)
static

Appends a binary file asynchronously.

Parameters
FileNameFilename.
DataBinary data
OffsetOffset into Data to start.
LengthNumber of bytes to write.

Definition at line 253 of file Resources.cs.

◆ GetAssembly()

static Assembly Waher.Content.Resources.GetAssembly ( string  ResourceName)
static

Gets the assembly corresponding to a given resource name.

Parameters
ResourceNameResource name.
Returns
Assembly.
Exceptions
ArgumentExceptionIf no assembly could be found.

Definition at line 22 of file Resources.cs.

◆ LoadCertificate() [1/4]

static X509Certificate2 Waher.Content.Resources.LoadCertificate ( string  ResourceName)
static

Loads a certificate from an embedded resource.

Parameters
ResourceNameResource Name.
Returns
Certificate.
Exceptions
IOExceptionIf Resource name is not valid or resource not found.

Definition at line 132 of file Resources.cs.

◆ LoadCertificate() [2/4]

static X509Certificate2 Waher.Content.Resources.LoadCertificate ( string  ResourceName,
Assembly  Assembly 
)
static

Loads a certificate from an embedded resource.

Parameters
ResourceNameResource Name.
AssemblyAssembly containing the resource.
Returns
Certificate.
Exceptions
IOExceptionIf Resource name is not valid or resource not found.

Definition at line 144 of file Resources.cs.

◆ LoadCertificate() [3/4]

static X509Certificate2 Waher.Content.Resources.LoadCertificate ( string  ResourceName,
string  Password 
)
static

Loads a certificate from an embedded resource.

Parameters
ResourceNameResource Name.
PasswordOptional password.
Returns
Certificate.
Exceptions
IOExceptionIf Resource name is not valid or resource not found.

Definition at line 156 of file Resources.cs.

◆ LoadCertificate() [4/4]

static X509Certificate2 Waher.Content.Resources.LoadCertificate ( string  ResourceName,
string  Password,
Assembly  Assembly 
)
static

Loads a certificate from an embedded resource.

Parameters
ResourceNameResource Name.
PasswordOptional password.
AssemblyAssembly containing the resource.
Returns
Certificate.
Exceptions
IOExceptionIf Resource name is not valid or resource not found.

Definition at line 169 of file Resources.cs.

◆ LoadResource() [1/2]

static byte[] Waher.Content.Resources.LoadResource ( string  ResourceName)
static

Loads a resource from an embedded resource.

Parameters
ResourceNameResource Name.
Returns
Binary content.
Exceptions
IOExceptionIf Resource name is not valid or resource not found.

Definition at line 61 of file Resources.cs.

◆ LoadResource() [2/2]

static byte[] Waher.Content.Resources.LoadResource ( string  ResourceName,
Assembly  Assembly 
)
static

Loads a resource from an embedded resource.

Parameters
ResourceNameResource Name.
AssemblyAssembly containing the resource.
Returns
Binary content.
Exceptions
IOExceptionIf Resource name is not valid or resource not found.

Definition at line 73 of file Resources.cs.

◆ LoadResourceAsText() [1/2]

static string Waher.Content.Resources.LoadResourceAsText ( string  ResourceName)
static

Loads a text resource from an embedded resource.

Parameters
ResourceNameResource Name.
Returns
Text content.
Exceptions
IOExceptionIf Resource name is not valid or resource not found.

Definition at line 96 of file Resources.cs.

◆ LoadResourceAsText() [2/2]

static string Waher.Content.Resources.LoadResourceAsText ( string  ResourceName,
Assembly  Assembly 
)
static

Loads a text resource from an embedded resource.

Parameters
ResourceNameResource Name.
AssemblyAssembly containing the resource.
Returns
Text content.
Exceptions
IOExceptionIf Resource name is not valid or resource not found.

Definition at line 108 of file Resources.cs.

◆ ReadAllBytesAsync()

static async Task< byte[]> Waher.Content.Resources.ReadAllBytesAsync ( string  FileName)
static

Reads a binary file asynchronously.

Parameters
FileNameFilename.
Returns
Binary content.

Definition at line 183 of file Resources.cs.

◆ ReadAllTextAsync()

static async Task< string > Waher.Content.Resources.ReadAllTextAsync ( string  FileName)
static

Reads a text file asynchronously.

Parameters
FileNameFilename.
Returns
Decoded text.

Definition at line 205 of file Resources.cs.

◆ WriteAllBytesAsync() [1/2]

static Task Waher.Content.Resources.WriteAllBytesAsync ( string  FileName,
byte[]  Data 
)
static

Creates a binary file asynchronously.

Parameters
FileNameFilename.
DataBinary data

Definition at line 216 of file Resources.cs.

◆ WriteAllBytesAsync() [2/2]

static async Task Waher.Content.Resources.WriteAllBytesAsync ( string  FileName,
byte[]  Data,
int  Offset,
int  Length 
)
static

Creates a binary file asynchronously.

Parameters
FileNameFilename.
DataBinary data
OffsetOffset into Data to start.
LengthNumber of bytes to write.

Definition at line 228 of file Resources.cs.

◆ WriteAllTextAsync() [1/2]

static Task Waher.Content.Resources.WriteAllTextAsync ( string  FileName,
string  Text 
)
static

Creates a text file asynchronously.

Parameters
FileNameFilename.
TextText

Definition at line 267 of file Resources.cs.

◆ WriteAllTextAsync() [2/2]

static async Task Waher.Content.Resources.WriteAllTextAsync ( string  FileName,
string  Text,
Encoding  Encoding 
)
static

Creates a text file asynchronously.

Parameters
FileNameFilename.
TextText
EncodingEncoding to use

Definition at line 278 of file Resources.cs.


The documentation for this class was generated from the following file: