Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Sonstige Fragen zu Delphi (https://www.delphipraxis.net/19-sonstige-fragen-zu-delphi/)
-   -   Delphi DFM-Datei binär? (https://www.delphipraxis.net/41064-dfm-datei-binaer.html)

alcaeus 25. Feb 2005 10:34


DFM-Datei binär?
 
Hallo allerseits,

ich habe hier eine dfm-Datei welche wohl Binär abgespeichert wird. Mein Delphi kann die Datei ganz normal lesen, aber auf einem anderen Computer kommt immer die Fehlermeldung "Invalid stream format". Weiß jemand wie ich die Datei (ohne alles neu zu machen) ins Textformat umwandeln kann? Ich hab zwar schon maximovs BinE probiert, leider ohne Erfolg.
Hat irgendjemand eine Idee?

Greetz
alcaeus

himitsu 25. Feb 2005 10:40

Re: DFM-Datei binär?
 
In Delphi gibt es irgendwo eine Option, wo man auswählen kann, als was gespeichert werden soll.

Du kannst aber auch ganz einfach die Datei in deinem Delphi öffnen, dann mir Rechts auf das entspechende Formular klicken, "Als Text anzeigen" auswählen und diesen Text dann mit 'nem Editor als Textdatei (allerdings mit .dfm) abspeichern und dann beide Dateien austauschen :zwinker:

(später speicher Delphi die Datei als das ab, als was sie geöffnet wurde)

NicoDE 25. Feb 2005 10:46

Re: DFM-Datei binär?
 
Zitat:

Zitat von alcaeus
Weiß jemand wie ich die Datei (ohne alles neu zu machen) ins Textformat umwandeln kann? Ich hab zwar schon maximovs BinE probiert, leider ohne Erfolg.
Hat irgendjemand eine Idee?

Im BIN-Ordner der Delphi-Installation befindet sich ein Kommandozeilentool namens convert.exe (nicht mit dem Windows-Tool zum Konvertieren des Dateisystems verwechseln). Wenn Du die passende Delphi-Version nicht (mehr) hast, kannst Du ja mal hier fragen ob es jemand übernimmt...

Gruß Nico

alcaeus 25. Feb 2005 10:48

Re: DFM-Datei binär?
 
Zitat:

Zitat von himitsu
In Delphi gibt es irgendwo eine Option, wo man auswählen kann, als was gespeichert werden soll.

Ja, habs jetzt gefunden: Rechtsklick aufs Formular, und dann "Text DFM" auswählen. Ich hab die Checkbox sicherlich schon 1 Million mal gesehn, aber die wär mir wirklich nicht aufgefallen :wall:

Danke euch allen

Greetz
alcaeus

MaBuSE 25. Feb 2005 12:49

Re: DFM-Datei binär?
 
Zitat:

Zitat von alcaeus
ich habe hier eine dfm-Datei welche wohl Binär abgespeichert wird. Mein Delphi kann die Datei ganz normal lesen, aber auf einem anderen Computer kommt immer die Fehlermeldung "Invalid stream format".

Diese Fehlermeldung kommt normalerweise nur wenn eine "ältere" Delphi Version das Binärformat einer "neueren" Delphi Format versucht zu lesen. (z.B. binäre D7 Dfm in D5 öffnen)
"Neuere" Delphi Versionen sollten aber immer noch das binäre Format der "älteren" Delphi Versionen lesen können.

Für dieses Problem gibt es das Tool DFMCleaner in der JVCL (jvcl\devtools\DFMCleaner)

dc.txt
DFMCleaner is a tool to remove unsupported properties from DFMs. If you save a dfm file in one version of Delphi and want to use it in an earlier version, chances are there are some unsupported properties in it, generating an error when the form is opened in Delphi. What's even worse, if the dfm is part of a design-time package, Delphi will install the package without errors but when you try to access the form at design-time (f ex if the form is used by a property editor), Delphi generates an AV instead.

Command-line:

dc.exe <options> <filemask> <filemask>

where <options> can be:
-i - replace in-line (output overwrites input). If not given, output uses input's filename but with a "txt" extension
-s - recurse into sub-folders
-f<filename> - read skiplist from <filename>, REQUIRED. Do not preceed filename with spaces!

<filemask> can be a filename or a filemask with wildcards. Also supports relative paths (like ..\source\*.dfm and source\*.dfm). Filemasks that contain spaces must be enclosed in single or double quotes

The output file is only written if it is different from the input. Input DFM's can be in either text or binary format but the output is always written in text format.

The skiplist has the following format:
Each row contains the name of a property to remove, preceeded by it's classname or a "*". A "*" means "any class".
Examples:
*.DesignSize - remove all DesignSize properties
TPageControl.TabIndex - remove TabIndex for TPageControl

Note that the tool cannot derive inheritance from the dfm, so all affected classes must be named explicitly, i.e if you want to remove TabIndex for TPageControl and all descendants, you must name them on one row each:
TPageControl.TabIndex
TJvPageControl.TabIndex
TPageControlEx.TabIndex
etc...

The skiplist file doesn't have to be sorted: it is sorted internally.

maximov 25. Feb 2005 12:55

Re: DFM-Datei binär?
 
Zitat:

Zitat von alcaeus
Hallo allerseits,

ich habe hier eine dfm-Datei welche wohl Binär abgespeichert wird. Mein Delphi kann die Datei ganz normal lesen, aber auf einem anderen Computer kommt immer die Fehlermeldung "Invalid stream format". Weiß jemand wie ich die Datei (ohne alles neu zu machen) ins Textformat umwandeln kann? Ich hab zwar schon maximovs BinE probiert, leider ohne Erfolg.
Hat irgendjemand eine Idee?

Greetz
alcaeus

Moin,

könntest du die datei mal anhängen. Mich würde nämlich mal interessieren warum die binär inkompatibel sind. Bzw. ob das historisch bedingt ist, denn zum konvertieren benutze ich ja auch nur die aktuellen standard delphi streamin-routinen. Oder, wenn sensible daten, dann vielleicht die ersten 100 bytes.

Pr0g 25. Feb 2005 12:58

Re: DFM-Datei binär?
 
Was hat es denn für Vorteile die Dfm Datei binär und nicht als Text zu speichern?


MfG Pr0g

MaBuSE 25. Feb 2005 12:59

Re: DFM-Datei binär?
 
und dann wäre da auch noch JConvert aus dem JVCL Packet (jvcl\devtools\JConvert)

readme.txt
JConvert is a command-line tool to convert dfm files between text and binary format.

It differs from Borland's tool in two ways:

1. It doesn't create a new file unless the dfm was actually converted from one format to the other.
This is essential when working with VCS systems like CVS because you only have to commit the files that were actually translated. If you convert a lot of dfm's this can save you some bandwidth and the need to commit files that appears to have changed but in reality hasn't

2. You can use the -c switch to check how many files would have been converted
This is great when you want to know if all your dfm's are in the right format without actually change them

maximov 25. Feb 2005 13:00

Re: DFM-Datei binär?
 
Zitat:

Zitat von Pr0g
Was hat es denn für Vorteile die Dfm Datei binär und nicht als Text zu speichern?


MfG Pr0g

Theoretisch: Wenn du viele bilder importiert hast, dann ist die DFM doppelt so klein, da sonst alle binärdaten ins hex-format konvertiert werden.

MaBuSE 25. Feb 2005 13:09

Re: DFM-Datei binär?
 
Zitat:

Zitat von Pr0g
Was hat es denn für Vorteile die Dfm Datei binär und nicht als Text zu speichern?

Per default werden *.dfm Dateien in neueren Delphi Versionen immer als Text gespeichert.
Ab Delphi 5 (glaube ich) hatte man die Möglichkeit zwischen Binär- und Text-Format zu wählen.

Delphi 1 z.B. konnte nur binär speichern.

Daher können auch die aktuellen Versionen noch mit den binären Format umgehen.
(Sonst könnte man ja kein "altes Projekt" mehr öffnen.)

Intern im Speicher arbeitet Delphi mit dem Binärformat.

Der Vorteil wäre dann eine kürzere Ladezeit, da Delphi das Textformat nicht in das binäre umwandel muß (, der aber so klein ist, das er nicht ins Gewicht fällt).

Wenn Du ein Versionsverwaltungssystem einsetzt, würde ich Dir auf jeden Fall raten *.dfm Dateien als Text zu speichern, da es nur dann sinnvoll ist Delta Informationen zu bilden und ein Diff bzw. Merge eines Branches möglich wird.

Ich hoffe das beantwortet Deine Frage und verwirrt dich nicht zu sehr ;-)

Pr0g 25. Feb 2005 13:38

Re: DFM-Datei binär?
 
Ja, ich denke das meine Frage damit beantwortet ist. Hätte also keine wirklichen Vorteile für mich.

alcaeus 28. Feb 2005 08:46

Re: DFM-Datei binär?
 
Zitat:

Zitat von maximov
könntest du die datei mal anhängen. Mich würde nämlich mal interessieren warum die binär inkompatibel sind. Bzw. ob das historisch bedingt ist, denn zum konvertieren benutze ich ja auch nur die aktuellen standard delphi streamin-routinen. Oder, wenn sensible daten, dann vielleicht die ersten 100 bytes.

Naja, ich habe die DFM-Datei natürlich in allen 4 Versionen geändert, da so ja das Compilieren der DLL unmöglich war. Ich kann mal sehn ob einer meiner Kollegen die Datei auf dem Rechner hat, aber ich befürchte nicht :-?

Greetz
alcaeus

maximov 28. Feb 2005 10:08

Re: DFM-Datei binär?
 
OK. Ist auch erstmal egal.


Alle Zeitangaben in WEZ +1. Es ist jetzt 02:32 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz