Table of Contents

Class CsvDataConnector

Namespace
Ranorex.Core.Data
Assembly
Ranorex.Core.dll

Provides access to data in a CSV (Character Separated Values) file.

public sealed class CsvDataConnector : FileDataConnector, IDisposable
Inheritance
CsvDataConnector
Implements
Inherited Members

Constructors

CsvDataConnector(XmlNode)

Initializes a new instance of the CsvDataConnector class.

public CsvDataConnector(XmlNode node)

Parameters

node XmlNode

An XML node containing the definition of the source.

CsvDataConnector(string, string, bool)

Initializes a new instance of the CsvDataConnector class.

public CsvDataConnector(string name, string fileName, bool withHeaders)

Parameters

name string

The name of the source.

fileName string

The name of the CSV file.

withHeaders bool

Sets the initial value of the WithHeaders property.

Remarks

This constructor overload sets the IncludeFile property to Indeterminate

CsvDataConnector(string, string, bool, CheckState)

Initializes a new instance of the CsvDataConnector class.

public CsvDataConnector(string name, string fileName, bool withHeaders, CheckState includeFile)

Parameters

name string

The name of the source.

fileName string

The name of the CSV file.

withHeaders bool

Sets the initial value of the WithHeaders property.

includeFile CheckState

Sets the initial value of the IncludeFile property.

Properties

IncludeFile

Gets or sets a value specifying whether the file should be included into the associated project.

public override CheckState IncludeFile { get; set; }

Property Value

CheckState

A value specifying whether to include the file into the associated project.

LastParseSeparatorChar

Gets the separator character used when last parsing the data from the CSV file.

public char LastParseSeparatorChar { get; }

Property Value

char

The separator character used for the last parsing operation or the default separator character ',' if this source has not yet loaded data from the CSV file.

SeparatorChar

Gets or sets the separator character.

public char? SeparatorChar { get; set; }

Property Value

char?

The separator character.

Remarks

If the value of this property is set to null, the source will try to automatically detect the separator character when parsing the data from the CSV file.

WithHeaders

Gets or sets a value indicating whether the CSV file contains a header specifying column names.

public bool WithHeaders { get; set; }

Property Value

bool

true if the CSV file contains a header specifying column names; otherwise, false.

Remarks

This property influences the way data is parsed from and written to the CSV file. If setting this property to true, the first line in the file is regarded as the header containing the names of the data columns

XmlIdentifier

Gets the unique identifier for serialization and deserialization purposes as well as factory creation.

public override string XmlIdentifier { get; }

Property Value

string

Methods

GetXMLNodeDerived(XmlNode)

Add DataSource specific information from derived classes to the node

protected override void GetXMLNodeDerived(XmlNode node)

Parameters

node XmlNode

The node to which information should be added.

LoadColumnsImpl(out ColumnCollection)

Loads the data columns from the CSV file.

protected override void LoadColumnsImpl(out ColumnCollection columns)

Parameters

columns ColumnCollection

The loaded columns.

LoadDataImpl(out ColumnCollection, out RowCollection)

Loads the data from the CSV file.

protected override void LoadDataImpl(out ColumnCollection columns, out RowCollection rows)

Parameters

columns ColumnCollection

The loaded columns.

rows RowCollection

The loaded rows.

StoreData(ColumnCollection, RowCollection, string)

Stores the data to the CSV file.

public void StoreData(ColumnCollection columns, RowCollection rows, string fileName)

Parameters

columns ColumnCollection

The columns to store.

rows RowCollection

The rows to store.

fileName string

The name of the file to write to.

StoreDataImpl(ColumnCollection, RowCollection)

Stores the data to the CSV file.

protected override void StoreDataImpl(ColumnCollection columns, RowCollection rows)

Parameters

columns ColumnCollection

The columns to store.

rows RowCollection

The rows to store.