Store binary file inside *.ini? lazarus / 21-General ---------------------------------------------------------------------- d2010 · 2025-06-09 23:14 I have one binary file pop1234.mp4. How to store inside file-ascii.ini? This "[PreviewPack]" are many many binery-code? C:Q1=How to encrypt the pop1234.mp4 to [PreviewPack]? I found this solution inside the game "Red Alert2 Yuri.iso" GigBecali-clickhere Code: [Select][PreviewPack] 1=zQ0AIAjVs23Vs2zVs2zXskABSAAJbNWzbNaxbNu2btqzbAFcAgO8m2KsilVdAtlwBW8E 1r 2=FrTAQD5bxy3LZuQAFIAL8Fu5pgQApYBEQCSAZABw/XsWzftWvZs2zGpWi/nGHDoWVMB1 wC 3=WARACkgABrycY9i0bt22b0wEXAKsAVgHSAAD4bpw17BrbgSbYie8AAAJv4dGwJ1crn5L k3 4=xNvqVm0KxmyZ9WtqJjtqJlKiwACeC/cte1bcWnZ8yjWFgKUxF/XTRQCFsNyadlTApcCy f8 5=AkAEWAFAE1wXXB1YBIAErxxx2LJ8IEAHvAJIA4AB3CBMB0sG47ltXBdSCOW8fAVYDUwB A+ 6=a/cue+cFwCQCKJBmxcAlwgSwDDoWNYECeMAEABQARIDJACfA6sB1wCUAtXAMalZyr0BE QC 7=WApEEUgkAt22bt61aAZECAPDomjBn2RcAlguvAJAEFwCUAhLAL6aXlwFtB5ALkQXA9ay bt 8=y1bUwEUAJYAVgTTwfBnmQnfAFAAbwIXAVQCwPDoWS6l11bDc+taqwHUDtIFSfUA1wUD7 2d 9=Y8SkZtCtan9bNJl7SZ+BTVQzCcWYTcmeVdOvacyraEABBtm3b+DAcs6mWWAB5DUIl31J p4 10=VMxpNQwJ5JGG1IGFALSABYJUgSUBdPE963cCecAl4Cw6JgDVwRTBxYAVg3TARMAUAuR BdI 11=BlAIpFNcAlwUSABQHVBWTAS0LUA3UAJIAFwCUE1QCAa9nGDAnGG5l2BMB7wCSANAHEg bQx 12=O7m2NEKbwCXAgpPAJ8QUgDSBJAB1gWVwMUFBRAB1xHQCtAAaQISD9YGUQFSABAFlgrJ 4QC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X57iwXlbNK2YW1ACUJ5AAUCmWE9c0VAFSGlIAFg HVA 28=kgbAgATC5IZlCMTBNMAViUQGpUUVwdUAJUAIkAbFCAQAFQNVBoRDUgbAgDUBFELFgTR EpI 29=AAmSdE91YTyXfk2fgU1UnEA0WJ1QnkDQJ5QTQAFYAS08GkQgXAhUCSByCABMLkAcpEp M3F 30=g0SABENVACSB5EF1zOUBdAAVBrUKEgcggDSBJIFVAUCbiQVsSHS4ZqP8KoZ2I0n1ZbZ 7ai 31=ZVQASwDfvnBIMyLhLcAiiDRIHic8GkwBRIlQ7FgcVAkgbAgAJ+wMQBxYZFgBSDZIALB rWD 32=QkjyTas2xkNSNcJ0iiIGwIA1ARUBQkfDFAlwOBYDmTdEQiGjuaXlNozq9sIaA0LR8N4 L9y 33=vAIqPBpmULZuVAkgcggARDJIM0gAQAFIAEABSABAAUA0U1PKpmIhjCSsASRUKSByCAN IEl 34=RIUBRETUNhrn5LQAG8aEOdmo9SQARLANWxayHkIFjQMDwabAeEUEQ1RAUgbAsA5bxyW Blc ---------------------------------------------------------------------- jamie · 2025-06-09 23:55 I suggest that if you are thinking of compacting binary data within a INI file you may want to consider a difference solution. INI files much be converted to text so that means you need to compress a little however, I see you have an mp3 or something of that sort which most likely will not compress much more.  I do have an idea however which you can use in two different ways since this is on the tip of my head at the moment and that is using a VirtualDrawTree.  You can use the one in LazControls or the one that Laz modeled from.  The idea is to create nodes that holds your settings of various items that your ini file now does and the good part is that you have an option to write and read user data attached to these nodes which can be compressed if you wish or written in raw state.   The items can be index, shown on the screen as a tree index if you wish or just hidden in the background so you can use the nodes abilities to write themselves out and in from file along with attaching custom data, like images and mp3 etc.  Think about it. Jamie ---------------------------------------------------------------------- Thaddy · 2025-06-10 04:48 Seems like a base64 encoded mp4 with line numbers added. For that you can use the base64 unit, except for the line numbers. Basically base64 translates a binary file to human readable characters and back(it is not compression). You must use TBase64Encoding stream connected to e.g. a filestream to do the encoding and use a TBase64decodingstream to convert back to binary mp4 format. If I have the time I will add an example later, but it is not difficult. There are other options, like adding it  a resource as RT_RCDATA or use bin2obj to create a linkable blob. Note you can also compress it first and then base64 encode it and the other way around. I would prefer a resource myself. ---------------------------------------------------------------------- paule32 · 2025-06-10 13:00 isn't ini Files for ASCII/UTF-8 Text's - isn't it ? why did you don't read/write the name of the binary. and the binary itself to a binary file ? So, you can use TreeView with the names, and on dbl click on a item, you read the background layed file. it is not a good idea to store a binary file directly into a ini file. ---------------------------------------------------------------------- Thaddy · 2025-06-11 06:29 As I wrote, encode and decode with base64 streams. ---------------------------------------------------------------------- dbannon · 2025-06-11 09:57 I would have thought that a big slab of base64 encoded data would slow down access to the .ini's regular data ?  I'd much rather have a separate file that is only read when that specific binary date is needed. Just an observation, maybe there is a very compelling reason to combine? Davo ---------------------------------------------------------------------- Thaddy · 2025-06-11 18:21 And,  Davo, what would be the encoding he showed otherwise ? Just curious...