Click or drag to resize
DHI.PFS Namespace

Class library documentation for the DHI.PFS.

The DHI.PFS library can read, edit and write files in the DHI PFS format.

The PFS format is used by a majority of setup file formats for MIKE by DHI engines and tools. File extensions that use the PFS format include (the list here is not complete):

  • MIKE 11: .sim11, .nwk11, .bnd11, .hd11.
  • MIKE 21: .m21, .m21fm.
  • MIKE 3: .m3, .m3fm.
  • MIKE SHE: .she, .wbl.
  • MIKE Zero Toobox: .mzt.
  • Plot Composer: .plc.
  • Mesh files: .mesh.

The important classes in the DHI.PFS namespace are:

  • PFSFile: Use the PFSFile class to read the PFS file content into memory. PFS content is then ready for reading, searching and modifying.
  • PFSTokenReader: Use the PFSTokenReader for reading the PFS file content "token-by-token". It is a fast, low memory, forward only way of reading the content of the PFS file.
  • PFSBuilder: Use the PFSBuilder for creating a new PFS tree structure and write it to file.

Classes
  ClassDescription
Public classCode examplePFSBuilder
The PFSBuilder is a class that can build a PFS structure in a "line by line" manner.
Public classPFSClob
Clob is short of Character Large Object.

A Clob can be used to store a multitude of parameters in a single PFS parameter e.g. storing vectors/matrices of coordinates. This can save space for the PFS file and improve performance of reading and handling the PFS file.

Reading data from a Clob works as iterating over a list of parameters. Calling one of the Get methods will return the "current" parameter and forward the iterator to the next parameter in the Clob.

The structure of the clob must be known beforehand, i.e. the number of Clob values and the order the different types of values in must match the order of methods called for retrieving the values. If that is not the case, an exception is thrown, i.e. if the next value in the Clob is a double, and the GetString method is called, an exception is thrown.

Public classPFSDllWrapper
Wrapper class for pfs2004.dll.

When possible, use instead the PFSFile, since it adds error checking and exceptions to the file handling.

Public classPFSException
Exception that is thrown in case of a failure in PFS system or in the use of the PFS system.
Public classPFSExtensions
Static class, providing a set of help or convenience functionality in the form of extension methods.
Public classCode examplePFSFile
A PFSFile object is the top level access to a PFS file.
Public classPFSKeyword
A PFSKeword object contains a list of parameters.

Several PFSKeywords can have equal names and different parameters.

Public classPFSParameter
A PFSParameter object refers to one single parameter of a Keyword.

Every parameter contains one type of value in it. It is the users responsibility to call the get value function matching the type of the parameter. If the parameter is an integer, and ToDouble() is called, an exception is thrown.

Public classPFSSection
A PFSSection object represents a section in a PFS file.

A PFSSection can have other sections and keywords inside it.

Public classCode examplePFSTokenReader
Class for reading content of a PFS file. It reads the PFS file token-by-token, when calling NextToken. If data is associated with the token, these data can be retrieved using GetTokenString.
Interfaces
  InterfaceDescription
Public interfaceIPFSBuilder
The IPFSBuilder is an interface for building a PFS structure or file in a "line by line" manner.
Delegates
  DelegateDescription
Public delegatepfsNodeCallback
Call back to use with pfsExplore.
Enumerations
  EnumerationDescription
Public enumerationPFSErrorCode
Error codes from PFS system
Public enumerationPFSToken
Tokens that can occur in a PFS file.