Table of Contents

Class FileReaderContext

Namespace
MES.MQC.DataSourceLibrary.Context
Assembly
MES.MQC.DataSourceLibrary.dll
public class FileReaderContext : ContextBase, IDisposable
Inheritance
FileReaderContext
Implements
Inherited Members

Properties

Content

File content of the report file.

public string Content { get; }

Property Value

string

DateTime

Date of the report file.

public DateTime DateTime { get; }

Property Value

DateTime

DateTimeIsReportDate

Should the DateTime of the FileContent be used as the report date?

public bool DateTimeIsReportDate { get; }

Property Value

bool

DirectoryPath

Directory path of the report file.

public string DirectoryPath { get; }

Property Value

string

ExtractFindings

Should the adapter import findings?

public bool ExtractFindings { get; }

Property Value

bool

FileExtension

File extension of the report file.

public string FileExtension { get; }

Property Value

string

FileName

File name of the report file.

public string FileName { get; }

Property Value

string

FileNameWithoutExtension

File name without extension of the report file.

public string FileNameWithoutExtension { get; }

Property Value

string

FilePath

File Path of the report file.

public string FilePath { get; }

Property Value

string

RelatedContents

public List<IFileContent> RelatedContents { get; }

Property Value

List<IFileContent>

Methods

AsDataSet(int)

AsDataSet is a Utility method. It loads the file path as an DataSet. The DataSet is stored in a property and returned. The reading of the file is therefore only done once.

public DataSet AsDataSet(int removeRows = 0)

Parameters

removeRows int

Number of rows to remove before parsing (e.g. invalid/merged rows above the header)

Returns

DataSet

DataSet (with DataTables, System.Data)

AsHtmlDocument()

AsHtmlDocument is a Utility method. It loads the file path as an HtmlDocument (HtmlAgilityPack). See https://html-agility-pack.net/ for documentation. The document is stored in a property and returned. The reading of the file is therefore only done once.

public HtmlDocument AsHtmlDocument()

Returns

HtmlDocument

HtmlDocument (HtmlAgilityPack)

AsXDocument(bool)

It loads the file path as an XDocument, which can be traversed via XPath. See https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/linq/linq-to-xml-overview for documentation. The document is stored in a property and returned. The reading of the file is therefore only done once.

public XDocument AsXDocument(bool throwWarning = true)

Parameters

throwWarning bool

Returns

XDocument

XDocument (System.Xml)

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

GetDataFromBag<T>(string, out T)

public bool GetDataFromBag<T>(string key, out T value)

Parameters

key string
value T

Returns

bool

Type Parameters

T

LoadHtmlDocument(Stream)

public HtmlDocument LoadHtmlDocument(Stream stream)

Parameters

stream Stream

Returns

HtmlDocument

LoadHtmlDocument(string)

public HtmlDocument LoadHtmlDocument(string content)

Parameters

content string

Returns

HtmlDocument

SetDataToBag<T>(string, T)

public void SetDataToBag<T>(string key, T value)

Parameters

key string
value T

Type Parameters

T