OpcFile Members

Namespace: Opc.UaFx.Client
Assemblies: Opc.UaFx.Advanced.dll, Opc.UaFx.Advanced.dll
The OpcFile type exposes the following members.

AppendAllLines(OpcClient, OpcNodeId, IEnumerable<String>)

Appends lines to a file maintained by the file node specified by fileNodeId and then closes the file.

C#

public static void AppendAllLines(OpcClient client, OpcNodeId fileNodeId, IEnumerable<string> contents)


Parameters

client OpcClient

The OpcClient to use when accessing the file node.

fileNodeId OpcNodeId

The OpcNodeId of the file node to access.

contents IEnumerable<String>

The lines to append to the file maintained by the file node.



Exceptions

ArgumentNullException

The client, fileNodeId or contents is a null reference (Nothing in Visual Basic).

InvalidOperationException

The file node referenced by the fileNodeId specified could not be found.


Remarks

Given the client, file node id and contents, this method opens the specified file, appends the contents to the end of the file, and then closes the file. The file handle is guaranteed to be closed by this method, even if exceptions are raised.

AppendAllLines(OpcClient, OpcNodeId, IEnumerable<String>, Encoding)

Appends lines to a file maintained by the file node specified by fileNodeId by using a specified encoding and then closes the file.

C#

public static void AppendAllLines(OpcClient client, OpcNodeId fileNodeId, IEnumerable<string> contents, Encoding encoding)


Parameters

client OpcClient

The OpcClient to use when accessing the file node.

fileNodeId OpcNodeId

The OpcNodeId of the file node to access.

contents IEnumerable<String>

The lines to append to the file maintained by the file node.

encoding Encoding

The character encoding to use.



Exceptions

ArgumentNullException

The client, fileNodeId, contents or encoding is a null reference (Nothing in Visual Basic).

InvalidOperationException

The file node referenced by the fileNodeId specified could not be found.


Remarks

Given the client, file node id and contents, this method opens the specified file, appends the contents to the end of the file, and then closes the file. The file handle is guaranteed to be closed by this method, even if exceptions are raised.

AppendAllLines(OpcClient, OpcNodeId, String[])

Appends lines to a file maintained by the file node specified by fileNodeId and then closes the file.

C#

public static void AppendAllLines(OpcClient client, OpcNodeId fileNodeId, params string[] contents)


Parameters

client OpcClient

The OpcClient to use when accessing the file node.

fileNodeId OpcNodeId

The OpcNodeId of the file node to access.

contents String[]

The lines to append to the file maintained by the file node.



Exceptions

ArgumentNullException

The client, fileNodeId or contents is a null reference (Nothing in Visual Basic).

InvalidOperationException

The file node referenced by the fileNodeId specified could not be found.


Remarks

Given the client, file node id and contents, this method opens the specified file, appends the contents to the end of the file, and then closes the file. The file handle is guaranteed to be closed by this method, even if exceptions are raised.

AppendAllText(OpcClient, OpcNodeId, String)

Appends the specified string to the file maintained by the file node specified by fileNodeId and then closes the file.

C#

public static void AppendAllText(OpcClient client, OpcNodeId fileNodeId, string contents)


Parameters

client OpcClient

The OpcClient to use when accessing the file node.

fileNodeId OpcNodeId

The OpcNodeId of the file node to access.

contents String

The string to append to the file maintained by the file node.



Exceptions

ArgumentNullException

The client, fileNodeId or contents is a null reference (Nothing in Visual Basic).

InvalidOperationException

The file node referenced by the fileNodeId specified could not be found.


Remarks

Given the client, file node id and string, this method opens the specified file, appends the string to the end of the file, and then closes the file. The file handle is guaranteed to be closed by this method, even if exceptions are raised.

AppendAllText(OpcClient, OpcNodeId, String, Encoding)

Appends the specified string to the file maintained by the file node specified by fileNodeId by using a specified encoding and then closes the file.

C#

public static void AppendAllText(OpcClient client, OpcNodeId fileNodeId, string contents, Encoding encoding)


Parameters

client OpcClient

The OpcClient to use when accessing the file node.

fileNodeId OpcNodeId

The OpcNodeId of the file node to access.

contents String

The string to append to the file maintained by the file node.

encoding Encoding

The character encoding to use.



Exceptions

ArgumentNullException

The client, fileNodeId, encoding or contents is a null reference (Nothing in Visual Basic).

InvalidOperationException

The file node referenced by the fileNodeId specified could not be found.


Remarks

Given the client, file node id, string and encoding, this method opens the specified file, appends the string to the end of the file, and then closes the file. The file handle is guaranteed to be closed by this method, even if exceptions are raised.

AppendText(OpcClient, OpcNodeId)

Creates a StreamWriter that appends UTF8 encoded text to the file maintained by the file node specified by fileNodeId.

C#

public static StreamWriter AppendText(OpcClient client, OpcNodeId fileNodeId)


Parameters

client OpcClient

The OpcClient to use when accessing the file node.

fileNodeId OpcNodeId

The OpcNodeId of the file node to access.


Returns

StreamWriter

A stream writer that appends UTF8 encoded text to the specified file node.



Exceptions

ArgumentNullException

The client or fileNodeId is a null reference (Nothing in Visual Basic).

InvalidOperationException

The file node referenced by the fileNodeId specified could not be found.

AppendText(OpcClient, OpcNodeId, Encoding)

Creates a StreamWriter that appends text by using a specified encoding to the file maintained by the file node specified by fileNodeId.

C#

public static StreamWriter AppendText(OpcClient client, OpcNodeId fileNodeId, Encoding encoding)


Parameters

client OpcClient

The OpcClient to use when accessing the file node.

fileNodeId OpcNodeId

The OpcNodeId of the file node to access.

encoding Encoding

The character encoding to use.


Returns

StreamWriter

A stream writer that appends text to the specified file node.



Exceptions

ArgumentNullException

The client, fileNodeId or encoding is a null reference (Nothing in Visual Basic).

InvalidOperationException

The file node referenced by the fileNodeId specified could not be found.

Open(OpcClient, OpcNodeId, OpcFileMode)

Opens a file in the specified mode.

C#

public static OpcFileStream Open(OpcClient client, OpcNodeId fileNodeId, OpcFileMode mode)


Parameters

client OpcClient

The OpcClient to use when accessing the file node.

fileNodeId OpcNodeId

The OpcNodeId of the file node to access.

mode OpcFileMode

A OpcFileMode member specifying the mode in which to open the file.


Returns

OpcFileStream

A OpcFileStream opened in the specified mode.



Exceptions

ArgumentNullException

The client or fileNodeId is a null reference (Nothing in Visual Basic).

InvalidOperationException

The file node referenced by the fileNodeId specified could not be found.

OpenRead(OpcClient, OpcNodeId)

Creates a read-only OpcFileStream.

C#

public static OpcFileStream OpenRead(OpcClient client, OpcNodeId fileNodeId)


Parameters

client OpcClient

The OpcClient to use when accessing the file node.

fileNodeId OpcNodeId

The OpcNodeId of the file node to access.


Returns

OpcFileStream

A new read-only OpcFileStream object.



Exceptions

ArgumentNullException

The client or fileNodeId is a null reference (Nothing in Visual Basic).

InvalidOperationException

The file node referenced by the fileNodeId specified could not be found.


Remarks

This method returns a read-only OpcFileStream object with the mode set to Read.

OpenText(OpcClient, OpcNodeId)

Creates a StreamReader with UTF8 encoding.

C#

public static StreamReader OpenText(OpcClient client, OpcNodeId fileNodeId)


Parameters

client OpcClient

The OpcClient to use when accessing the file node.

fileNodeId OpcNodeId

The OpcNodeId of the file node to access.


Returns

StreamReader

A new StreamReader with UTF8 encoding.



Exceptions

ArgumentNullException

The client or fileNodeId is a null reference (Nothing in Visual Basic).

InvalidOperationException

The file node referenced by the fileNodeId specified could not be found.

OpenWrite(OpcClient, OpcNodeId)

Creates a write-only OpcFileStream.

C#

public static OpcFileStream OpenWrite(OpcClient client, OpcNodeId fileNodeId)


Parameters

client OpcClient

The OpcClient to use when accessing the file node.

fileNodeId OpcNodeId

The OpcNodeId of the file node to access.


Returns

OpcFileStream

A write-only OpcFileStream object.



Exceptions

ArgumentNullException

The client or fileNodeId is a null reference (Nothing in Visual Basic).

InvalidOperationException

The file node referenced by the fileNodeId specified could not be found.


Remarks

This method returns a write-only OpcFileStream object with the mode set to Write.

The stream created does not append the new content to the existing content. Instead, it overwrites the existing data with the new data. If you overwrite longer data (such as “This is a test of the OpenWrite method”) with a shorter string (like “Second ”), the file will contain a mix of the strings (“Second test of the OpenWrite method”).

ReadAllBytes(OpcClient, OpcNodeId)

Opens a binary file node, reads the contents of the file node into a byte array, and then closes the file node.

C#

public static byte[] ReadAllBytes(OpcClient client, OpcNodeId fileNodeId)


Parameters

client OpcClient

The OpcClient to use when accessing the file node.

fileNodeId OpcNodeId

The OpcNodeId of the file node to access.


Returns

Byte[]

A byte array containing the contents of the file maintained by the file node.



Exceptions

ArgumentNullException

The client or fileNodeId is a null reference (Nothing in Visual Basic).

InvalidOperationException

The file node referenced by the fileNodeId specified could not be found.

ReadAllLines(OpcClient, OpcNodeId)

Opens a text file node, reads all lines of the file maintained by the file node, and then closes the file node.

C#

public static string[] ReadAllLines(OpcClient client, OpcNodeId fileNodeId)


Parameters

client OpcClient

The OpcClient to use when accessing the file node.

fileNodeId OpcNodeId

The OpcNodeId of the file node to access.


Returns

String[]

A string array containing all lines of the file maintained by the file node.



Exceptions

ArgumentNullException

The client or fileNodeId is a null reference (Nothing in Visual Basic).

InvalidOperationException

The file node referenced by the fileNodeId specified could not be found.

OutOfMemoryException

There is insufficient memory to allocate a buffer for the returned string.

ReadAllLines(OpcClient, OpcNodeId, Encoding)

Opens a file node, reads all lines of the file maintained by the file node with the specified encoding, and then closes the file node.

C#

public static string[] ReadAllLines(OpcClient client, OpcNodeId fileNodeId, Encoding encoding)


Parameters

client OpcClient

The OpcClient to use when accessing the file node.

fileNodeId OpcNodeId

The OpcNodeId of the file node to access.

encoding Encoding

The encoding applied to the contents of the file node.


Returns

String[]

A string array containing all lines of the file maintained by the file node.



Exceptions

ArgumentNullException

The client, fileNodeId or encoding is a null reference (Nothing in Visual Basic).

InvalidOperationException

The file node referenced by the fileNodeId specified could not be found.

OutOfMemoryException

There is insufficient memory to allocate a buffer for the returned string.

ReadAllText(OpcClient, OpcNodeId)

Opens a file node, reads all lines of the file maintained by the file node, and then closes the file node.

C#

public static string ReadAllText(OpcClient client, OpcNodeId fileNodeId)


Parameters

client OpcClient

The OpcClient to use when accessing the file node.

fileNodeId OpcNodeId

The OpcNodeId of the file node to access.


Returns

String

A string containing all lines of the file maintained by the file node.



Exceptions

ArgumentNullException

The client, fileNodeId is a null reference (Nothing in Visual Basic).

InvalidOperationException

The file node referenced by the fileNodeId specified could not be found.

OutOfMemoryException

There is insufficient memory to allocate a buffer for the returned string.

ReadAllText(OpcClient, OpcNodeId, Encoding)

Opens a file node, reads all lines of the file maintained by the file node with the specified encoding, and then closes the file node.

C#

public static string ReadAllText(OpcClient client, OpcNodeId fileNodeId, Encoding encoding)


Parameters

client OpcClient

The OpcClient to use when accessing the file node.

fileNodeId OpcNodeId

The OpcNodeId of the file node to access.

encoding Encoding

The encoding applied to the contents of the file.


Returns

String

A string containing all lines of the file maintained by the file node.



Exceptions

ArgumentNullException

The client, fileNodeId or encoding is a null reference (Nothing in Visual Basic).

InvalidOperationException

The file node referenced by the fileNodeId specified could not be found.

OutOfMemoryException

There is insufficient memory to allocate a buffer for the returned string.