Namespace: Opc.UaFx.Client
Assemblies: Opc.UaFx.Advanced.dll, Opc.UaFx.Advanced.dll
The OpcFile type exposes the following members.
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
The client
, fileNodeId
or contents
is a null reference (Nothing in Visual Basic).
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.
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
The client
, fileNodeId
, contents
or encoding
is a null reference (Nothing in Visual Basic).
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.
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
The client
, fileNodeId
or contents
is a null reference (Nothing in Visual Basic).
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.
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
The client
, fileNodeId
or contents
is a null reference (Nothing in Visual Basic).
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.
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
The client
, fileNodeId
, encoding
or contents
is a null reference (Nothing in Visual Basic).
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.
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
A stream writer that appends UTF8 encoded text to the specified file node.
Exceptions
The client
or fileNodeId
is a null reference (Nothing in Visual Basic).
The file node referenced by the fileNodeId
specified could not be found.
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
A stream writer that appends text to the specified file node.
Exceptions
The client
, fileNodeId
or encoding
is a null reference (Nothing in Visual Basic).
The file node referenced by the fileNodeId
specified could not be found.
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
A OpcFileStream opened in the specified mode.
Exceptions
The client
or fileNodeId
is a null reference (Nothing in Visual Basic).
The file node referenced by the fileNodeId
specified could not be found.
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
A new read-only OpcFileStream object.
Exceptions
The client
or fileNodeId
is a null reference (Nothing in Visual Basic).
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.
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
A new StreamReader with UTF8 encoding.
Exceptions
The client
or fileNodeId
is a null reference (Nothing in Visual Basic).
The file node referenced by the fileNodeId
specified could not be found.
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
A write-only OpcFileStream object.
Exceptions
The client
or fileNodeId
is a null reference (Nothing in Visual Basic).
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”).
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
The client
or fileNodeId
is a null reference (Nothing in Visual Basic).
The file node referenced by the fileNodeId
specified could not be found.
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
The client
or fileNodeId
is a null reference (Nothing in Visual Basic).
The file node referenced by the fileNodeId
specified could not be found.
There is insufficient memory to allocate a buffer for the returned string.
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
The client
, fileNodeId
or encoding
is a null reference (Nothing in Visual Basic).
The file node referenced by the fileNodeId
specified could not be found.
There is insufficient memory to allocate a buffer for the returned string.
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
A string containing all lines of the file maintained by the file node.
Exceptions
The client
, fileNodeId
is a null reference (Nothing in Visual Basic).
The file node referenced by the fileNodeId
specified could not be found.
There is insufficient memory to allocate a buffer for the returned string.
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
A string containing all lines of the file maintained by the file node.
Exceptions
The client
, fileNodeId
or encoding
is a null reference (Nothing in Visual Basic).
The file node referenced by the fileNodeId
specified could not be found.
There is insufficient memory to allocate a buffer for the returned string.