Class TNCFile
Abstract class ancestor for all types of output files formed by postprocessor.
Namespace: DotnetPostprocessing.SDK
Assembly: DotnetPostprocessing.SDK.dll
Syntax
public abstract class TNCFile : Object
Constructors
TNCFile()
Initializes a new instance of TNCFile object and assigns TNCFilesManager.Singletone.DefaultNCFilesOwner
as an
Owner.
Declaration
public TNCFile()
TNCFile(INCFileOwner)
Initializes a new instance of TNCFile object and assigns specified object as an Owner.
Declaration
public TNCFile(INCFileOwner Owner)
Parameters
Type | Name | Description |
---|---|---|
INCFileOwner | Owner | The object that is the owner of the output file formed by the postprocessor. Usually the owner is a postprocessor itself. |
Properties
Manager
The object that contains and manages the whole list of output files generated by the postprocessor.
Declaration
public TNCFilesManager Manager { get; }
Property Value
Type | Description |
---|---|
TNCFilesManager |
OutputFileName
The file name with a full path where this output file should be saved at the finish.
Declaration
public virtual string OutputFileName { get; set; }
Property Value
Type | Description |
---|---|
string |
Owner
The object that is the owner of the output file formed by the postprocessor. Usually the owner is a postprocessor itself.
Declaration
public INCFileOwner Owner { get; init; }
Property Value
Type | Description |
---|---|
INCFileOwner |
Methods
Flush()
The virtual empty method that can be overriden inside inheritors. It should write the buffered in memory data for the output file to a hard drive (to a temporary files, not to the final destination). Usually you don't need to call it manually, the postprocessing system calls it as needed.
Declaration
public virtual void Flush()
OnInit()
Makes an initialization of a new instance of TNCFile. Use it instead of constructor because the constructor has already been used inside the autogenerated Registers.cs file to initialize the list of registers (NCWords). By default it is empty but you can override it inside exact postprocessor to implement custom logic just after a new output file creation.
Declaration
public virtual void OnInit()
SaveToFile(string)
The virtual empty method that can be overriden inside inheritors. This method is called by the system automatically at the most final stage of the postprocessor's work. Here the content of the file should be written from a temporary storage (in memory or temporary file) to the destination file specified in the OutputFileName property.
After this saving the OnFinalizeNCFiles(TNCFilesManager) handler of the postprocessor is called where you can implement some additional actions on the output files.
Declaration
public virtual void SaveToFile(string fileName)
Parameters
Type | Name | Description |
---|---|---|
string | fileName | The destination file path. |