Add CatchPreferences(*Preference,PreferenceSize.i[, Flags])

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Mijikai
Addict
Addict
Posts: 1360
Joined: Sun Sep 11, 2016 2:17 pm

Add CatchPreferences(*Preference,PreferenceSize.i[, Flags])

Post by Mijikai »

Add CatchPreferences(*Preference,PreferenceSize.i[, Flags])
nsstudios
Enthusiast
Enthusiast
Posts: 274
Joined: Wed Aug 28, 2019 1:01 pm
Location: Serbia
Contact:

Re: Add CatchPreferences(*Preference,PreferenceSize.i[, Flags])

Post by nsstudios »

+1
being able to load inis from memory was something I've actually needed before, and saving a temporary file and quickly deleting is not very convenient.
Quin
Enthusiast
Enthusiast
Posts: 282
Joined: Thu Mar 31, 2022 7:03 pm
Location: United States
Contact:

Re: Add CatchPreferences(*Preference,PreferenceSize.i[, Flags])

Post by Quin »

+1, needed this in my project today.
PB v5.40/6.10, Windows 10 64-bit.
16-core AMD Ryzen 9 5950X, 128 GB DDR5.
User avatar
mk-soft
Always Here
Always Here
Posts: 5335
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Add CatchPreferences(*Preference,PreferenceSize.i[, Flags])

Post by mk-soft »

-1
Makes no sense, because you cannot write prefs into the executable.
You can also read the data cleanly from a DataSection.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
User_Russian
Addict
Addict
Posts: 1443
Joined: Wed Nov 12, 2008 5:01 pm
Location: Russia

Re: Add CatchPreferences(*Preference,PreferenceSize.i[, Flags])

Post by User_Russian »

mk-soft wrote: Thu Jan 04, 2024 9:21 pm Makes no sense
It makes sense. PB can only read/save in UTF-8.
You can load an ini file in a different encoding (ascii, utf-16) into memory using functions from the "File" library and use CatchPreferences().
nsstudios
Enthusiast
Enthusiast
Posts: 274
Joined: Wed Aug 28, 2019 1:01 pm
Location: Serbia
Contact:

Re: Add CatchPreferences(*Preference,PreferenceSize.i[, Flags])

Post by nsstudios »

I don't get what y'all are talking about.
If I want to include an ini file into my executable with includeBinary, just like I would include a json file, or an xml file, and I could CatchJson/CatchXml, or even, heck, ParseJson/ParseXml, why shouldn't I be able to CatchPreferences and ParsePreferences? :?:
Or not even only for reading from executable, but what about reading/parsing it from a memory buffer downloaded with network lib, or http lib, or a string made up on the fly, or many other cases where needing to write to a (temporary) file is not ideal at all.
User avatar
jacdelad
Addict
Addict
Posts: 1431
Joined: Wed Feb 03, 2021 12:46 pm
Location: Planet Riesa
Contact:

Re: Add CatchPreferences(*Preference,PreferenceSize.i[, Flags])

Post by jacdelad »

All functions that write into/read from files should be doable in memore too. Including, imho, SVGVectorOut() (why do I necessarily have to write it into a file?).
PureBasic 6.04/XProfan X4a/Embarcadero RAD Studio 11/Perl 5.2/Python 3.10
Windows 11/Ryzen 5800X/32GB RAM/Radeon 7770 OC/3TB SSD/11TB HDD
Synology DS1821+/36GB RAM/130TB
Synology DS920+/20GB RAM/54TB
Synology DS916+ii/8GB RAM/12TB
Post Reply