Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

/// <summary>
/// NhaxWriter constructor that writes data to one or more Nhax files.
/// If more than one Nhax file are created the file will contain a Misc section containing al Misc data provided. The user section will only contain users that are referenced by patients or actions.
/// </summary>
/// <param name="path">Path where the files is stored</param>
/// <param name="filePrefix">The prefix of the Nhax file. The file name is "filePrefix-dddddd" where d is digit e.g. "file-000001", "file-000002"</param>
/// <param name="password">Password to access the file</param>
/// <param name="nhaxFileCreatedCallback">Function called when Nhax file is written. The is called with the name of the file that is written. Can be set to null.</param>
/// <param name="overwriteExistingFiles">True existing files will be overwritten. If false an error will be reported if file exists.</param>
/// <param name="compressData">If true data are compressed</param>
/// <param name="maxFileSize">Max size of created file. When this size is reached a new Nhax file is created and data written to this file.</param>
public NhaxWriter(string path, string filePrefix, string password, NhaxFileCreatedCallback nhaxFileCreatedCallback = null, bool overwriteExistingFiles = false, bool compressData = true, long maxFileSize = ConstMaxFileSize)/// <summary>
/// NhaxWriter constructor for writing Nhax formatted data to a stream
/// </summary>
/// <param name="outStream">Output stream. Must support CanWrite and CanSeek-</param>
/// <param name="password">Password to access data in the stream</param>
/// <param name="compressData">If true data are compressed</param>
public NhaxWriter(Stream outStream, string password, bool compressData = true )

When the NhaxWriter instance has been created WriteUsers and WriteMiscData must be called in order to add users and add Misc data to the Nhax file. These functions must be called before the WritePatient is called. Each call of WritePatient will add a patient to the Nhax file. If size of the current Nhax file exceeds the maxFileSize a new Nhax file is created and NhaxFileCreatedCallback is called if set in the constructor.

It is possible to call the writeUsers multiple times but when writing patient data. The users referred from a patient object must be knowm when WritePatient is called.

IMPORTANT: Be aware that the Nhax Writer implements the idisposable interface. It is important that dispose in order to update the binary part of the Nhax file correctly.

...