AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Suche Komponente um Settings in Datei zu speichern

Ein Thema von Shark99 · begonnen am 14. Feb 2012 · letzter Beitrag vom 19. Feb 2012
Antwort Antwort
Seite 1 von 2  1 2      
Shark99

Registriert seit: 16. Mai 2007
403 Beiträge
 
#1

Suche Komponente um Settings in Datei zu speichern

  Alt 14. Feb 2012, 21:44
Ich bin dabei eine neue Win32 App mit Delphi zu entwickeln und wollte diesmal keine Registry mehr benutzen um die Einstellungen/Programmdaten zu speichern. Statt dessen wäre mir eine Datei im User Verzeichnis viel lieber (easy Backup etc). Ich wollte aber flexibler sein als es mit einer Ini-Datei möglich ist. Es wäre nett wenn ich verschiedene Datensätze, z.b. Bilder und Unicode Texte abspeichern könnte. Alles sollte aber in einer Datei sein, also irgendwas in der Art von XML. Es sollte leicht zu benutzen sein (will nicht manuell Daten parsen müssen).

Kann mir jemand bitte hier was empfehlen? Darf auch eine kostenpflichtige Komponente sein.
  Mit Zitat antworten Zitat
Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.114 Beiträge
 
Delphi 12 Athens
 
#2

AW: Suche Komponente um Settings in Datei zu speichern

  Alt 14. Feb 2012, 21:59
'ne fertige Komponente (wegen der Bilder und der großen Daten) kenn ich jetzt nicht,

Aber XML mit XPath muß nicht umständlich sein, ohne viel zu parsen.
Zusätzlich gibt es für XML auch Möglichkeit dieses über Datenobjekte zu verwalten.
Ich vergeß immer den Namen, aber vor wenigen Tagen wurde hier darüber gesprochen. (läßt sich bestimmt finden, wenn man nach XML sucht)
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
  Mit Zitat antworten Zitat
Benutzerbild von Ralf Kaiser
Ralf Kaiser

Registriert seit: 21. Mär 2005
Ort: Wuppertal
932 Beiträge
 
Delphi 10.3 Rio
 
#3

AW: Suche Komponente um Settings in Datei zu speichern

  Alt 14. Feb 2012, 22:20
Eventuell OmniXML?
Ralf Kaiser
  Mit Zitat antworten Zitat
Popov
(Gast)

n/a Beiträge
 
#4

AW: Suche Komponente um Settings in Datei zu speichern

  Alt 14. Feb 2012, 22:48
Eventuell (MyBase) TClientDataSet (bei Delphi 7 im Register Datenzugriff). Ist eine Clientdatenbank und speichert laut OH Binär und XML. Ich selbst habe zwar noch nie damit gearbeitet, bis auf ein mal angetestet, aber es sollte genau das bieten was du brauchst.
  Mit Zitat antworten Zitat
schlecki

Registriert seit: 11. Apr 2005
Ort: Darmstadt
148 Beiträge
 
Delphi XE2 Enterprise
 
#5

AW: Suche Komponente um Settings in Datei zu speichern

  Alt 14. Feb 2012, 23:15
was ich in letzter Zeit immer gerne mache, ist Settings und so Zeugs im json-Format zu speichern. Das ist nicht so gesprächig (im Sinne von doppelten Tags) wie XML und lässt auch alle möglichen Arten von Daten zu. Und der Zugriff ist mit TSuperObject (einfach googlen - liegt glaube ich auch direkt bei google) super-easy

Delphi-Quellcode:
var
  cfg: ISuperObject; // ist sogar ein Interface - braucht also nicht freigegeben werden :)
begin
  cfg := SO('{Settings: {Value1: "Hallo", Value2: 5}}');
  Writeln(cfg.S['Settings.Value1']); // Eigenschaften sind Case-Sensitiv!
  cfg.I['Settings.NewValue'] := 10;
  
  Writeln(cfg.AsJson(true));
end;
Es gibt iirc auch direkt ParseFile und SaveToFile - hier habe ich aber die Parameter und genauen Namen nicht im Kopf...

Viel Spaß
schlecki
  Mit Zitat antworten Zitat
Wishmaster

Registriert seit: 14. Sep 2002
Ort: Steinbach, MB, Canada
301 Beiträge
 
Delphi XE2 Architect
 
#6

AW: Suche Komponente um Settings in Datei zu speichern

  Alt 15. Feb 2012, 05:02
NativeXml

Features

Read XML directly from string, stream or file with fast parser (1Mb/sec on 1.5GHz P3), writes to string, stream and file even faster.

Import of all common tags, including comments, CDATA, XML declarations and stylesheets.

Load from streaming media is supported; you can set up events to work with the node data while it comes in. See example 1. No need to keep the whole XML document in memory! Works well for huge documents. This is the SAX-like approach.

Save to file, string or stream in readable, preserve or compact format. Readable format will add linefeeds and indents to make the file readable in a text editor. Compact format sticks to the Xml specification and adds minimal control characters. Preserve format keeps the markup of the document exactly as it was.

Directly add blobs or streams in the XML file, they will be encoded as Binhex or Base64 (but you don't have to worry about that).

Many native Delphi types can be stored directly to the nodes, making this code very suitable to use while writing storage methods. Store and load boolean, single, double, word, integer, string, TFont, TColor, TPen, TBrush, TDateTime. You don't have to worry about escaping the strings; this is done automatically.

Loads and saves ANSI, UTF-8 as well as Unicode (UTF-16) documents and implements proper conversion warnings. Recognises streams even without byte order marks. NativeXml works internally with UTF8 encoded strings to preserve extended characters, and supports widestrings.

Unique feature: Store, read and create any TPersistent object to/from XML directly (see Example5). This is done by iterating through all of the objects' published properties by use of RTTI (runtime type information). This feature is only available for D5 and up.
New! Now you can use the binary format of NativeXml. This avoids the expensive parsing process to get the textual xml data into the document (DOM). And even better, the binary file size is much smaller, ~50% of file size with uncompressed binary files, and ~15% of the file size in zlib-compressed files. And you can use AES encryption to keep your sensitive files safe from prying eyes.
The interface is the same whether textual xml or binary xml files are used, so you can work with binary files for speed and size purposes, then always send them to the public as normal xml files.
  Mit Zitat antworten Zitat
Benutzerbild von stahli
stahli

Registriert seit: 26. Nov 2003
Ort: Halle/Saale
4.336 Beiträge
 
Delphi 11 Alexandria
 
#7

AW: Suche Komponente um Settings in Datei zu speichern

  Alt 16. Feb 2012, 11:42
Man könnte auch die Bilddaten komprimieren und anschließend in Base64 umwandeln. Dann sollten sie sich auch in Ini´s speichern lassen.
(In einfachen Textdateien funktioniert das jedenfalls. Bei Ini´s könnte die Stringlänge evtl. Probleme machen.)
Stahli
http://www.StahliSoft.de
---
"Jetzt muss ich seh´n, dass ich kein Denkfehler mach...!?" Dittsche (2004)
  Mit Zitat antworten Zitat
Benutzerbild von BMI
BMI

Registriert seit: 16. Jul 2010
58 Beiträge
 
Delphi 2 Desktop
 
#8

AW: Suche Komponente um Settings in Datei zu speichern

  Alt 16. Feb 2012, 14:55
Es wäre nett wenn ich verschiedene Datensätze, z.b. Bilder und Unicode Texte abspeichern könnte.
mhh, Du hast aber nicht zuvor irgendwie BMP oder gar AVI oder .flv/mp4 in der Registry abgespeichert?


So Experten gab es schon mal.
Die haben auch regelmäßig Bitmap-Grafiken in der Registry abgespeichert .... weil sie gehört hatten, daß kleine Dateien die Festplatte so fragmentieren.

Speichere doch Bilder extern als BMP, PNG oder Tif und nicht in ner Settings-Datei.

reicht schon, wenn eingebettete Videofilme die Powerpointdateien so aufblähen.
eine Signatur? - in 2022? - WOZU ?!!!
  Mit Zitat antworten Zitat
Shark99

Registriert seit: 16. Mai 2007
403 Beiträge
 
#9

AW: Suche Komponente um Settings in Datei zu speichern

  Alt 17. Feb 2012, 04:31
Nein, hab bis jetzt einen Mix aus Registry und Dateien im User Verzeichnis genommen. Will aber nun am besten nur eine Datei haben, von der die Benutzer leicht ein Backup machen könnten. Waren paar gute Vorschläge dabei. Danke!
  Mit Zitat antworten Zitat
Steku

Registriert seit: 12. Mai 2008
181 Beiträge
 
Delphi 10.2 Tokyo Starter
 
#10

AW: Suche Komponente um Settings in Datei zu speichern

  Alt 17. Feb 2012, 08:38
Dann denk' doch mal darüber nach es so zu machen, wie Microsoft
mit seinen .Docx / .Xlsx Formaten.

Das sind letztlich Zip-Dateien, die eine Ordner-Struktur beinhalten
in denen dann die Infos als XML Datei und die originalen Dateien/Bilder
abgelegt sind.

Vielleicht reicht dir ja schon eine Zip-Datei als
Container + eine Ini in der du die entsprechenden Settings reinschreibst.

Gruß
Steku
  Mit Zitat antworten Zitat
Antwort Antwort
Seite 1 von 2  1 2      


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 08:06 Uhr.
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz