I need to read Files that are written with the TClientDataset class from Delphi with .NET Code. The Solution mentioned here does not work for me.
-
3I don't know a thing about `TClientDataset`, but maybe you should explain *why* that solution doesn't work for you? – Andreas Rejbrand Apr 30 '11 at 20:25
-
The Files that i need to write are from an other application and i need to read the files with a .NET Programm which does not run on the windows platform. so it is not possible to use a delphi application that exports the file as xml for me. – Noffls Apr 30 '11 at 20:29
-
@Noffls, In which format is written the file? `XML`or `binary`? – RRUZ Apr 30 '11 at 20:45
-
Binary; XML wouldn't be a problem ;-) – Noffls Apr 30 '11 at 20:51
-
@Noffls, as far i know the CDS (Binary) format if not documented (so you are out of luck here). you say which you can't write a delphi application to export (or transform) these files to XML because the app must run in a non windows platform. but what about to write a webservice with delphi which exposes these file as XML? (obviously this webservice must run from a windows OS) and then consume this webservice from .net – RRUZ Apr 30 '11 at 21:26
-
Unfortunatly, a webservice is also not possible, because the files contain very sensible personal data and so this won't be a solution for us. Currently i try to reverse engineer the format. It is a little strange but i think it could be possible – Noffls Apr 30 '11 at 21:33
-
@Noffls, "so it is not possible to use a delphi application that exports the file as xml for me"... yes it is possible if you use ftp to move the input data file to a more capable platform, transform it, then ftp it back. – Sam May 02 '11 at 04:41
-
@Sam it is the same as using a webservice. The data within the file is very sensible personal data and it is not allowed to send the files to a webservice/ftp-server or something like that – Noffls May 02 '11 at 05:30
-
@Noffls, it's a .cds which nobody knows how to read anyway! Use a USB stick! Encrypt the cds file with a 128bit key! If the file is so sensitive maybe the author didn't want you to read it from .Net. – Sam May 02 '11 at 05:49
3 Answers
"A dotNet program that does not run on Windows platform" means to me that you're deploying a Mono application. Possibly on Linux, if that's the case try WINE and see if the Delph app suggested above works as expected. If yes, your problem of leaving the dotnet app machine is solved as both will run on the same hardware without communication through network.
EDIT: since the OP now specified that he's using MonoDroid and Monotouch, and therefore can't use Wine- the remaining options are:
- Reverse engineer the format (consult a lawyer first to protect yourself from harm)
- Ask Embarcadero for a definition of the file ( I don't put much hope on it)
- Modify the Delphi/C++ Application to export the files in XML
- Create an Delphi application to preprocess those *.cds and export them to XML before sending them to the iOS / Android machine.
Of the four alternatives, the fourth one is possibly the fastest - the best one is the third.
The first one can get you in trouble because of all those laws against rev engineer around the world ( in USA there are DMCA which I heard is very draconian - but IANAL and not even an US-citizen).
The second one is a bet.

- 1
- 1

- 3,810
- 3
- 28
- 43
-
-
Finally we have decided to modify the original Application to save the Datasets in XML. Fortunately, the Load-Method of the Dataset recognizes whether the File is in the binary format or in Xml and so also old Versions of the Application can load the new Files. – Noffls May 09 '11 at 18:15
You need to use Delphi to write a small app to read the cds file and write its contents to a file that you can read from .Net (you choose the appropriate format). You can download free trial versions of Delphi. You can develop the app on a separate pc. You can ftp the input *.cds file from your problematic platform to the pc where this new app will reside. You then run the app and ftp the newly created output file to your problematic platform, then read it with .Net.
You can move files from one platform to another with ftp. No reason to lock yourself into one platform if there's a nice tool you need to use (or about to make!) on another platform. :-)

- 2,663
- 10
- 41
- 60
-
As I have written in the comments to the original question it is not possible to do send the file around because it is not allowed to send the data to a server/webservice. – Noffls May 02 '11 at 05:31
-
@Noffls, it's a .cds which nobody knows how to read anyway! Use a USB stick! Encrypt the cds file with a 128bit key! The solution is clear and secure enough. Nobody is suggesting you post it on Facebook! – Sam May 02 '11 at 05:47
-
@Noffls, if you don't have permission to access the file, then why try to read it with .Net anyway? Why would anyone assume ftp/webservice transmission is less secure than your future .Net code? – Sam May 02 '11 at 06:25
-
@Noffls, and if you want to read it with .Net, doesn't that imply that you have security access to the file's contents? LOL, this has nothing to do with security. – Sam May 02 '11 at 06:28
-
@Sam: no offense, but it is a given fact that i can't use a webservice or a server. Our Customers work with personal data of other people and it would be against the law if they transmit the files to any third party (including my company). – Noffls May 02 '11 at 17:56
-
@Noffls, you can't build a house without bricks regardless whether it's legal or not. If you don't have permission to access the relevant artefacts for this project (at least a sample cds with test data - doesn't have to be real data!!!) then your whole question is redundant. – Sam May 03 '11 at 00:56
actually original cds binary format IS documented quite extensively in corresponding US patent filed by Hejlsberg/Hansen. I must admit that later borland extended it with few extra features (such as nested datasets support) but basically it is still the very same format and with little digging in midas sources (they released it back in d2010) one can build his own parser as I did

- 463
- 2
- 8
-
what language is your parser in? Does it only interpret CDS or can it write rows directly to a CDS file? – skibulk May 31 '12 at 13:02
-
it is the part of my own midas implementation based on hyperbase written in delphi – Vladimir Ulchenko May 31 '12 at 13:58