Giter VIP home page Giter VIP logo

tps-parse's Introduction

tps-parse

Library for parsing Clarion TPS files. Also contains a TPS to CSV converter.

(C) 2012-2021 E.Hooijmeijer, Apache 2 licensed

WARNING : This software is based on Reverse Engineered TPS Files. As such, its probably incomplete and may mis-interpret data. It is no replacement for any existing Clarion tooling. Check the output files thoroughly before proceeding.

Typical use: java -jar tps-to-csv.jar -s [source file or folder] -t [target file or folder]

Read the blogpost or this one about the encryption of TPS files.

Download the binary.

Sample code

    //
    // Read the TPS file
    //
    TpsFile tpsFile = new TpsFile(new File("datafile.tps"));
    //
    // TPS files can contain multiple tables (commonly only one is used).
    //
    Map<Integer, TableDefinitionRecord> tables = tpsFile.getTableDefinitions(false);
    for (Map.Entry<Integer, TableDefinitionRecord> entry : tables.entrySet()) {
        TableDefinitionRecord table = entry.getValue();
        //
        // For each table get the field definition (columns).
        //
        for (FieldDefinitionRecord field : table.getFields()) {
            // Do something with the field definition.
        }
        //
        // And data records (rows).
        //
        for (DataRecord rec : tpsFile.getDataRecords(entry.getKey(), entry.getValue(), false)) {
            // Do something with the data record.
        }
    }

Example for an encrypted TPS file:

    TpsFile tpsFile = new TpsFile(new File("datafile.tps"), "password");

V1.0.15 05 March 2021

  • improved performance on record to memo matching.
  • key recovery work in progress utility classes.

V1.0.14 31 May 2014

  • version number reporting.
  • ignoreErrors writes available bytes of blobs with invalid length.

V1.0.13 9 May 2014

  • Improved loading of the TPS file by allocating all memory in advance.

V1.0.12 30 Mar 2014

  • TpsPage flushing, less memory is used at the expense of CPU.
  • Added memory reporting when running with -verbose.
  • Byte buffers are now shared instead of copied where possible.
  • For TPS files with multiple tables, the name is now exposed in the CSV file name.

V1.0.11 03 Jan 2014

  • Fixed a bug in array handling. Correct offset is now used.

V1.0.10 21 Dec 2013

  • Added support for custom TPS string encodings such as CP850.

V1.0.9 22 Aug 2013

  • Leading zero's of BCD values are now trimmed.
  • Fixed a bug in BCD parsing. For some TPS files the 'bcdLengthOfElement' value exceeds the number of available (remaining) digits. The value is now ignored and the actual length of available digits is taken.

V1.0.8 15 May 2013

  • Streaming Support for large files.
  • Refactoring of TPS to CSV utility.
  • removed sort option as its now implicit (use -direct to not sort).
  • added verbose option to have some sense of progress on large files.

V1.0.7 11 May 2013

  • Support for encrypted files.

V1.0.6 04 May 2013

  • Support for Binary Memo's (aka BLOBs)

V1.0.5 26 Feb 2013

  • Support for BCD fields
  • Support for Array fields
  • Expand Array fields into multiple CSV columns

V1.0.4 21 Jan 2013

  • Move to Github

V1.0.3 21 Jan 2013

  • Unit tests.
  • Java doc.

V1.0.2 13 Jan 2013

  • Fixed bug in page scanning, where a page was missed when the previous ended at a page boundary
  • Added character -encoding support to render csv in specific encoding.
  • Added -raw support to have the csv without any applied encodings.
  • Added -compare to topscan generated csv file.
  • Added -sort to sort the records to their row nr before outputting.

V1.0.1 01 Jan 2013

  • Fixed bug in Block parsing, resulting in record duplication.
  • Added support for parsing indexes.
  • Added support for Table Name Records
  • Added -layout option to display file layout.

V1.0.0 31 Dec 2012

  • First Release

tps-parse's People

Contributors

ctrl-alt-dev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tps-parse's Issues

OEM Tables

Hi, sometimes the table is marked like OEM, so the data is saved in CP850 format. Perharps adding a new parameters like -oem the functions related to read string can switch from ISO-8859-1 to CP850.
Ex:
public String fixedLengthString(int len) {
String str = new String(data, ofs, len, Charset.forName("cp850"));
ofs += len;
return str;
}
Thanks in advance

Guillermo

Array index out of range

Array index out of range: 1065634308 how can I increase the array index when the file to be extracted is very big

Password not valid or other error

Hi, I have the encrypted error. I have set the password, but not sure that is the good password. Not all file are encrypted.

java -jar tps-to-csv.jar -s ./240529data -t ./240529data_csv -e -password "_&$#"

Encrypted file, using set password.
Exception in thread "main" nl.cad.tpsparse.tps.NotATopSpeedFileException: File doesn't start with 0x00000000 - its not a TopSpeed file or it may be 'encrypted'.
	at nl.cad.tpsparse.tps.TpsHeader.<init>(TpsHeader.java:50)
	at nl.cad.tpsparse.tps.TpsFile.getHeader(TpsFile.java:191)
	at nl.cad.tpsparse.tps.TpsFile.<init>(TpsFile.java:155)
	at nl.cad.tpsparse.tps.TpsFile.<init>(TpsFile.java:116)
	at nl.cad.tpsparse.Main.openFile(Main.java:298)
	at nl.cad.tpsparse.Main.parseFile(Main.java:166)
	at nl.cad.tpsparse.Main.main(Main.java:132)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.