Click or drag to resize
PFSTokenReader Class
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.
Inheritance Hierarchy
SystemObject
  DHI.PFSPFSTokenReader

Namespace: DHI.PFS
Assembly: DHI.PFS (in DHI.PFS.dll) Version: 16.0.0.0 (11.1.1.1111)
Syntax
public class PFSTokenReader : IDisposable

The PFSTokenReader type exposes the following members.

Constructors
  NameDescription
Public methodPFSTokenReader
Create a reader, opening the file specified.
Top
Methods
  NameDescription
Public methodClose
Close Pfs file.

Any use of the PFSTokenReader after call to close will throw an exception.

Public methodDispose
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
Public methodEquals
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Public methodGetHashCode
Serves as a hash function for a particular type.
(Inherited from Object.)
Public methodGetTokenString
Get the string related to the current token.

Not all token types have data related to it. Only the following tokens have data:

Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodNextToken
Returns the next token in the PFS file
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Examples
Example of use:
PFSTokenReader reader = new PFSTokenReader(filename);

int tokenCount = 0;
PFSToken pfstNextToken;
while ((pfstNextToken = reader.NextToken()) != PFSToken.PfsEOF)
{
  if (pfstNextToken == PFSToken.KeyWord &&
      reader.GetTokenString() == "key3")
  {
    // Do something with keyword
  }
  tokenCount++;
}

reader.Dispose();
See Also