Reference
OpcFile Members
Provides static (Shared in Visual Basic) methods for opening of a single file and aids in the creation of OpcFileStream objects.
Reference
OpcFile Members
- Type
- OpcFile
- Namespace
- Opc.UaFx.Client
- Assembly
- Opc.UaFx.Advanced.dll
- Package
- Opc.UaFx.Advanced v2.59.0
- Also in
- Opc.UaFx.Client
Methods
AppendAllLines
| Overload | Description |
|---|---|
| AppendAllLines( | Appends lines to a file maintained by the file node specified by fileNodeId and then closes the file. |
| AppendAllLines( | Appends lines to a file maintained by the file node specified by fileNodeId and then closes the file. |
| AppendAllLines( | Appends lines to a file maintained by the file node specified by fileNodeId by using a specified encoding and then closes the file. |
Exceptions (all overloads)
| Exception | Condition |
|---|---|
| Invalid | The file node referenced by the fileNodeId specified could not be found. |
AppendAllLines(OpcClient, OpcNodeId, params string[])
Appends lines to a file maintained by the file node specified by fileNodeId and then closes the file.
public static void AppendAllLines(
OpcClient client,
OpcNodeId fileNodeId,
params string[] contents)Public Shared Sub AppendAllLines(
client As OpcClient,
fileNodeId As OpcNodeId,
ParamArray contents As String())Parameters
| Name | Type | Description |
|---|---|---|
client | OpcClient | The OpcClient to use when accessing the file node. |
fileNodeId | OpcNodeId | The OpcNodeId of the file node to access. |
contents | params String[] | The lines to append to the file maintained by the file node. |
Exceptions
| Exception | Condition |
|---|---|
| Argument | The client, fileNodeId or contents is a null reference ( |
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>)
Appends lines to a file maintained by the file node specified by fileNodeId and then closes the file.
public static void AppendAllLines(
OpcClient client,
OpcNodeId fileNodeId,
IEnumerable<string> contents)Public Shared Sub AppendAllLines(
client As OpcClient,
fileNodeId As OpcNodeId,
contents As IEnumerable(Of String))Parameters
| Name | Type | Description |
|---|---|---|
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
| Exception | Condition |
|---|---|
| Argument | The client, fileNodeId or contents is a null reference ( |
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.
public static void AppendAllLines(
OpcClient client,
OpcNodeId fileNodeId,
IEnumerable<string> contents,
Encoding encoding)Public Shared Sub AppendAllLines(
client As OpcClient,
fileNodeId As OpcNodeId,
contents As IEnumerable(Of String),
encoding As Encoding)Parameters
| Name | Type | Description |
|---|---|---|
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
| Exception | Condition |
|---|---|
| Argument | The client, fileNodeId, contents or encoding is a null reference ( |
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
| Overload | Description |
|---|---|
| AppendAllText( | Appends the specified string to the file maintained by the file node specified by fileNodeId and then closes the file. |
| AppendAllText( | 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. |
Exceptions (all overloads)
| Exception | Condition |
|---|---|
| Invalid | The file node referenced by the fileNodeId specified could not be found. |
AppendAllText(OpcClient, OpcNodeId, string)
Appends the specified string to the file maintained by the file node specified by fileNodeId and then closes the file.
public static void AppendAllText(
OpcClient client,
OpcNodeId fileNodeId,
string contents)Public Shared Sub AppendAllText(
client As OpcClient,
fileNodeId As OpcNodeId,
contents As String)Parameters
| Name | Type | Description |
|---|---|---|
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
| Exception | Condition |
|---|---|
| Argument | The client, fileNodeId or contents is a null reference ( |
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.
public static void AppendAllText(
OpcClient client,
OpcNodeId fileNodeId,
string contents,
Encoding encoding)Public Shared Sub AppendAllText(
client As OpcClient,
fileNodeId As OpcNodeId,
contents As String,
encoding As Encoding)Parameters
| Name | Type | Description |
|---|---|---|
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
| Exception | Condition |
|---|---|
| Argument | The client, fileNodeId, encoding or contents is a null reference ( |
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
| Overload | Description |
|---|---|
| AppendText( | Creates a StreamWriter that appends UTF8 encoded text to the file maintained by the file node specified by fileNodeId. |
| AppendText( | Creates a StreamWriter that appends text by using a specified encoding to the file maintained by the file node specified by fileNodeId. |
Exceptions (all overloads)
| Exception | Condition |
|---|---|
| Invalid | The file node referenced by the fileNodeId specified could not be found. |
AppendText(OpcClient, OpcNodeId)
Creates a StreamWriter that appends UTF8 encoded text to the file maintained by the file node specified by fileNodeId.
public static StreamWriter AppendText(OpcClient client, OpcNodeId fileNodeId)Public Shared Function AppendText(
client As OpcClient,
fileNodeId As OpcNodeId) As StreamWriterParameters
| Name | Type | Description |
|---|---|---|
client | OpcClient | The OpcClient to use when accessing the file node. |
fileNodeId | OpcNodeId | The OpcNodeId of the file node to access. |
Returns
A stream writer that appends UTF8 encoded text to the specified file node.
Exceptions
| Exception | Condition |
|---|---|
| Argument | The client or fileNodeId is a null reference ( |
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.
public static StreamWriter AppendText(
OpcClient client,
OpcNodeId fileNodeId,
Encoding encoding)Public Shared Function AppendText(
client As OpcClient,
fileNodeId As OpcNodeId,
encoding As Encoding) As StreamWriterParameters
| Name | Type | Description |
|---|---|---|
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
A stream writer that appends text to the specified file node.
Exceptions
| Exception | Condition |
|---|---|
| Argument | The client, fileNodeId or encoding is a null reference ( |
Open
Opens a file in the specified mode.
public static OpcFileStream Open(
OpcClient client,
OpcNodeId fileNodeId,
OpcFileMode mode)Public Shared Function Open(
client As OpcClient,
fileNodeId As OpcNodeId,
mode As OpcFileMode) As OpcFileStreamParameters
| Name | Type | Description |
|---|---|---|
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
A OpcFileStream opened in the specified mode.
Exceptions
| Exception | Condition |
|---|---|
| Argument | The client or fileNodeId is a null reference ( |
| Invalid | The file node referenced by the fileNodeId specified could not be found. |
OpenRead
Creates a read-only OpcFileStream.
public static OpcFileStream OpenRead(OpcClient client, OpcNodeId fileNodeId)Public Shared Function OpenRead(
client As OpcClient,
fileNodeId As OpcNodeId) As OpcFileStreamParameters
| Name | Type | Description |
|---|---|---|
client | OpcClient | The OpcClient to use when accessing the file node. |
fileNodeId | OpcNodeId | The OpcNodeId of the file node to access. |
Returns
A new read-only OpcFileStream object.
Exceptions
| Exception | Condition |
|---|---|
| Argument | The client or fileNodeId is a null reference ( |
| Invalid | 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
Creates a StreamReader with UTF8 encoding.
public static StreamReader OpenText(OpcClient client, OpcNodeId fileNodeId)Public Shared Function OpenText(
client As OpcClient,
fileNodeId As OpcNodeId) As StreamReaderParameters
| Name | Type | Description |
|---|---|---|
client | OpcClient | The OpcClient to use when accessing the file node. |
fileNodeId | OpcNodeId | The OpcNodeId of the file node to access. |
Returns
A new StreamReader with UTF8 encoding.
Exceptions
| Exception | Condition |
|---|---|
| Argument | The client or fileNodeId is a null reference ( |
| Invalid | The file node referenced by the fileNodeId specified could not be found. |
OpenWrite
Creates a write-only OpcFileStream.
public static OpcFileStream OpenWrite(OpcClient client, OpcNodeId fileNodeId)Public Shared Function OpenWrite(
client As OpcClient,
fileNodeId As OpcNodeId) As OpcFileStreamParameters
| Name | Type | Description |
|---|---|---|
client | OpcClient | The OpcClient to use when accessing the file node. |
fileNodeId | OpcNodeId | The OpcNodeId of the file node to access. |
Returns
A write-only OpcFileStream object.
Exceptions
| Exception | Condition |
|---|---|
| Argument | The client or fileNodeId is a null reference ( |
| Invalid | 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
Opens a binary file node, reads the contents of the file node into a byte array, and then closes the file node.
public static byte[] ReadAllBytes(OpcClient client, OpcNodeId fileNodeId)Public Shared Function ReadAllBytes(
client As OpcClient,
fileNodeId As OpcNodeId) As Byte()Parameters
| Name | Type | Description |
|---|---|---|
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
| Exception | Condition |
|---|---|
| Argument | The client or fileNodeId is a null reference ( |
| Invalid | The file node referenced by the fileNodeId specified could not be found. |
ReadAllLines
| Overload | Description |
|---|---|
| ReadAllLines( | Opens a text file node, reads all lines of the file maintained by the file node, and then closes the file node. |
| ReadAllLines( | 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. |
Exceptions (all overloads)
| Exception | Condition |
|---|---|
| Invalid | The file node referenced by the fileNodeId specified could not be found. |
| Out | There is insufficient memory to allocate a buffer for the returned string. |
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.
public static string[] ReadAllLines(OpcClient client, OpcNodeId fileNodeId)Public Shared Function ReadAllLines(
client As OpcClient,
fileNodeId As OpcNodeId) As String()Parameters
| Name | Type | Description |
|---|---|---|
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
| Exception | Condition |
|---|---|
| Argument | The client or fileNodeId is a null reference ( |
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.
public static string[] ReadAllLines(
OpcClient client,
OpcNodeId fileNodeId,
Encoding encoding)Public Shared Function ReadAllLines(
client As OpcClient,
fileNodeId As OpcNodeId,
encoding As Encoding) As String()Parameters
| Name | Type | Description |
|---|---|---|
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
| Exception | Condition |
|---|---|
| Argument | The client, fileNodeId or encoding is a null reference ( |
ReadAllText
| Overload | Description |
|---|---|
| ReadAllText( | Opens a file node, reads all lines of the file maintained by the file node, and then closes the file node. |
| ReadAllText( | 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. |
Exceptions (all overloads)
| Exception | Condition |
|---|---|
| Invalid | The file node referenced by the fileNodeId specified could not be found. |
| Out | 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.
public static string ReadAllText(OpcClient client, OpcNodeId fileNodeId)Public Shared Function ReadAllText(
client As OpcClient,
fileNodeId As OpcNodeId) As StringParameters
| Name | Type | Description |
|---|---|---|
client | OpcClient | The OpcClient to use when accessing the file node. |
fileNodeId | OpcNodeId | The OpcNodeId of the file node to access. |
Returns
A string containing all lines of the file maintained by the file node.
Exceptions
| Exception | Condition |
|---|---|
| Argument | The client, fileNodeId is a null reference ( |
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.
public static string ReadAllText(
OpcClient client,
OpcNodeId fileNodeId,
Encoding encoding)Public Shared Function ReadAllText(
client As OpcClient,
fileNodeId As OpcNodeId,
encoding As Encoding) As StringParameters
| Name | Type | Description |
|---|---|---|
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
A string containing all lines of the file maintained by the file node.
Exceptions
| Exception | Condition |
|---|---|
| Argument | The client, fileNodeId or encoding is a null reference ( |

