I want to provide a file via OPC-UA from my file system. With the UaModeler I have created a custom object which has a component FileType to provide the file.
In the code I'm using the BindModel on the custom object and set the FileModel like this:
Code: Select all
var fileModel = new FileModel
{
FileOnDisk = new FileInfo(file),
Writable = false,
UserWritable = false
};
if (File.Exists(file))
{
fileModel.Size = (ulong)fileModel.FileOnDisk.Length;
}
File = fileModel;
I also tried to call File.FileOnDisk.Refresh(), but it was not updated.
However after I used UaExpert to save to local file, then the size property is updated and shown correctly in UaExpert.
What is the correct way to update the file?