What is a GCD file and what program or whats the name of the lab equipment that made it? "Shimadzu GC Solution Data File (*.gcd)" ?
LabSolutions PDF
Data Acquisition
Offers minimum sampling time of 4 ms, snapshot function, single analys
+is and batch analysis capability, Batch Table Wizard, analysis add or
insert function, extended analysis time function, automatic data file
+name creation, QA/QC (statistical) functions, batch auto-stop functio
+n, user
program launcher function, pre-run program support, and OLE automation
+ compatibility (for batch analysis, etc.).
Your program has OLE. Use it. Reverse engineering a binary file is dozens of hours of work and a good knowledge of C (to understand how floating points/LE BE integers/bitfields and structs are layed out in memory). Unless your problem is you need to decode the GCD file on a PC without LabSolutions/Vendor's software or you dont have a license for the hypothetical OLE Addon at your lab? Can't you save the data in some format that is more commonly used?
It will probably be easier for you to spit out ASCII plain text files, like the one you showed, then regex in perl the ASCII plain text report.
I agree. Storage_Lite is terrible to use. I wrote up the following to dump the compound file.
#!/usr/bin/perl -w
use strict;
use Data::Dumper;
use OLE::Storage_Lite;
use Encode;
use String::Escape qw( backslash );
$Data::Dumper::Useqq = 0;
my $ole = OLE::Storage_Lite->new("lab.gcd");
my $oleroot = $ole->getPpsTree([1]);
my %cleanoleroot;
sub CleanHash {
my($full, $clean) = @_;
if(ref($full->{'Child'})) {
$clean->{Child} = [];
foreach(@{$full->{'Child'}}) {
my %hash = ();
push(@{$clean->{Child}}, \%hash);
CleanHash($_, \%hash);
}
}
$clean->{'Name'} = decode('UTF-16LE', $full->{'Name'});
$clean->{'DataEscaped'} = backslash($full->{'Data'});
$clean->{'Data'} = $full->{'Data'};
}
CleanHash($oleroot,\%cleanoleroot);
print Dumper(\%cleanoleroot);
run this as "perl gcdfile.pl > gcddump.txt", the file will be ~1.5 MB. I changed the name of the GCD file to lab.gcd. Change it to whatever. |