Equilla TextFileReader
The TextFileReader object is an
Equilla COM-based Extension that is included as part of the standard Tradesignal installation. The TextFileReader object presents an Application Programmers Interface (API) for reading text files from the local workstation or network.
The full Visual Studio project and source code for the TextFileReader object are included in the Tradesignal install directory under the
Samples folder. The sample project demonstrates how to create an Equilla COM-based extension using unmanaged C++.
The TextFileReader will try to determine the encoding of the text file (ASCII, UTF-8, UTF-16, etc.).
Usage Example
This example indicator will read a text file (identified by filename input) and output the file line by line to the Tradesignal output window with line numbering:
Input:
Filename( "C:\MyTextFile.txt" );
Object:
textFileReader( "EquillaExt.TextFileReader" );
Variables:
currentLine( "" ), lineNumber( 0 );
If CurrentBar = 1 Then Begin
If textFileReader.OpenTextFile( Filename ) Then Begin
While textFileReader.IsEOF() = False Begin
currentLine = textFileReader.ReadLine();
lineNumber = lineNumber + 1;
Print( lineNumber, currentLine );
End;
textFileReader.CloseFile();
End;
End;
Please note: Before you can compile the above sample, you may need to enable Equilla extensions using the option under
File > Tradesignal Options > Equilla.
TextFileReader Interface
[ProgId("EquillaExt.TextFileReader")]
interface ITextFileReader
{
bool OpenTextFile(string Filename);
bool CloseFile();
string ReadLine();
string ReadChars(int NumberOfChars);
DateTime GetCreateDate();
DateTime GetModifyDate();
int GetFileLength();
int GetFilePosition();
bool SetFilePosition(int Position);
bool IsEOF();
bool IsOpen();
string GetFilename();
}