PureBasic Forum
https://www.purebasic.fr/english/

Data Maker for OS X & Windows
https://www.purebasic.fr/english/viewtopic.php?f=27&t=59301
Page 1 of 2

Author:  J. Baker [ Sun May 11, 2014 7:14 am ]
Post subject:  Data Maker for OS X & Windows

A nice little tool by Wilbert and I (mainly Wilbert) to convert your file(s) to data. We've been using it for some time now but decided to package it up and release it. :D
Image
Features:

  • Easy and clean interface.
  • Drag and drop your file(s).
  • Copy the data to the clipboard.
  • Select "BriefLZ", "LZMA" and "Zip" for compression or "None".
  • Select the number of quads per line.
  • Looks nice on retina displays too!

Download Data Maker v1.0.2 (Developer signed for OS X 10.6+)
Download Data Maker v1.0.2 (Windows)

Image

Author:  Mythros [ Sun May 11, 2014 4:29 pm ]
Post subject:  Re: Data Maker for OS X

For the love of GOD can you PLEASE make this for windows?! O_O

Thank You!

Author:  ts-soft [ Sun May 11, 2014 6:28 pm ]
Post subject:  Re: Data Maker for OS X

Mythros wrote:
For the love of GOD can you PLEASE make this for windows?! O_O

Thank You!

viewtopic.php?p=374183#p374183
Crossplattform!

Greetings - Thomas

Author:  J. Baker [ Tue Nov 21, 2017 5:30 am ]
Post subject:  Re: Data Maker for OS X

Mythros wrote:
For the love of GOD can you PLEASE make this for windows?! O_O

Thank You!

I apologize. I guess I did not subscribe to this post and did not know anyone had posted. :oops:
I just added a Windows version to download in the first post. ;)

Author:  wilbert [ Tue Nov 21, 2017 7:04 am ]
Post subject:  Re: Data Maker for OS X

J. Baker wrote:
I just added a Windows version to download in the first post. ;)

:D

Author:  kvitaliy [ Tue Nov 21, 2017 10:01 am ]
Post subject:  Re: Data Maker for OS X & Windows

In Windows 7 64bit I always use text of 125% (medium):
Image

Author:  J. Baker [ Tue Nov 21, 2017 3:33 pm ]
Post subject:  Re: Data Maker for OS X & Windows

kvitaliy wrote:
In Windows 7 64bit I always use text of 125% (medium):
Image

There will be a fix later with a couple of other small fixes and error checking for file size. Current max file size is 256 kb but will bump it to 1 MB. Just in case a file happens to be over the 256 Kb max. That should be more than enough room, I believe. ;)

Author:  J. Baker [ Wed Nov 22, 2017 6:19 am ]
Post subject:  Re: Data Maker for OS X & Windows

Data Maker v1.0.1 released. Minor GUI adjustments, error checking, and the file limit was raised from 256KB to 1MB.

I'm not sure what a 125% font would look like now. I tried to adjust the gadgets a bit.

Enjoy! ;)

Author:  Otrebor [ Wed Nov 22, 2017 3:05 pm ]
Post subject:  Re: Data Maker for OS X & Windows

Nice :)
thank's.

Author:  J. Baker [ Wed Nov 22, 2017 11:25 pm ]
Post subject:  Re: Data Maker for OS X & Windows

There was a bug in the Windows version. If your data was wider than the editor gadget, it would create a horizontal scroll bar, of course. When the window was maximized and minimized, the horizontal scroll bar would drop below the editor gadgets main view. Anyways, It has been fixed.

I also added images for when the buttons are pressed. It appears to work better on Windows than it does on OS X. OS X doesn't always show the pressed button image for some reason. Maybe a greater version than OS X 10.6.8 works better?

Version 1.0.2 is available for both Windows and OS X. I think that should do it for this app, unless I find a better work around for the button images on OS X. ;)

Author:  oO0XX0Oo [ Sun Dec 10, 2017 7:18 pm ]
Post subject:  Re: Data Maker for OS X & Windows

Hi,

I could need some help here (if possible)...

Let's say I have a .txt file on Windows with this content
Code:
<?xml version="1.0" encoding="UTF-8"?>
<RootNode Version="1">
   <Groups>
      <Device>
         <Effects>
            <On>
               <Annotation Value="The first event, do not find me!" />
            </On>
            <Annotation Value="Another event, still not the one we are searching for" />
         </Effects>
      </Device>
   </Groups>
</RootNode>


I'm using CRLF for line endings and the file is saved as UTF-8 BOM

When I now include this file via Data Maker v1.02 (Compression: None, Quads per Line: 5)
I get this DataSection (and I added the code to display it):
Code:
Debug PeekS(?Test_XML_UTF8_BOM_xml_start, -1, #PB_UTF8)

DataSection

  Test_XML_UTF8_BOM_xml_start:
    ; size : 322 bytes
    Data.q $6C6D783F3CBFBBEF,$6E6F697372657620,$652022302E31223D,$3D676E69646F636E,$3F22382D46545522
    Data.q $746F6F523C0A0D3E,$7265562065646F4E,$2231223D6E6F6973,$6F72473C090A0D3E,$09090A0D3E737075
    Data.q $3E6563697665443C,$66453C0909090A0D,$0A0D3E7374636566,$3E6E4F3C09090909,$3C09090909090A0D
    Data.q $697461746F6E6E41,$65756C6156206E6F,$696620656854223D,$6E65766520747372,$6F6E206F64202C74
    Data.q $6D20646E69662074,$0A0D3E2F20222165,$6E4F2F3C09090909,$3C090909090A0D3E,$697461746F6E6E41
    Data.q $65756C6156206E6F,$6568746F6E41223D,$2C746E6576652072,$6E206C6C69747320,$6F2065687420746F
    Data.q $726120657720656E,$6863726165732065,$22726F6620676E69,$0909090A0D3E2F20,$7463656666452F3C
    Data.q $2F3C09090A0D3E73,$0D3E656369766544,$756F72472F3C090A,$522F3C0A0D3E7370,$3E65646F4E746F6F
    Data.b $0D,$0A
  Test_XML_UTF8_BOM_xml_end:

EndDataSection


My problem is, what the debug output shows now:
https://imgur.com/Icj4kw4

Where does this
Code:
Text$

come from (and how to get rid of it)?


And a section question:
If I'd want to use a compression algo like LZMA, how
exactly would I decompress the data in the DataSection
and store it in a string afterwards?

Author:  J. Baker [ Sun Dec 10, 2017 8:19 pm ]
Post subject:  Re: Data Maker for OS X & Windows

I couldn't get your data section to work in OS X for some reason. I remade your xml file on OS X and did the following...
Code:
Debug PeekS(?Test_XML_UTF8_BOM_xml_start, 363, #PB_UTF8)

DataSection

  Test_XML_UTF8_BOM_xml_start:
    ; size : 363 bytes
    Data.q $6576206C6D783F3C,$31223D6E6F697372,$6F636E652022302E,$5455223D676E6964,$3C0A3E3F22382D46
    Data.q $65646F4E746F6F52,$6E6F697372655620,$20200A3E2231223D,$7370756F72473C20,$2020202020200A3E
    Data.q $3E6563697665443C,$202020202020200A,$63656666453C2020,$202020200A3E7374,$2020202020202020
    Data.q $2020200A3E6E4F3C,$2020202020202020,$6E6E413C20202020,$206E6F697461746F,$54223D65756C6156
    Data.q $7473726966206568,$202C746E65766520,$6620746F6E206F64,$2221656D20646E69,$202020200A3E2F20
    Data.q $2020202020202020,$20200A3E6E4F2F3C,$2020202020202020,$746F6E6E413C2020,$6156206E6F697461
    Data.q $6F6E41223D65756C,$6576652072656874,$6C697473202C746E,$687420746F6E206C,$657720656E6F2065
    Data.q $6165732065726120,$6620676E69686372,$200A3E2F2022726F,$2020202020202020,$7463656666452F3C
    Data.q $20202020200A3E73,$63697665442F3C20,$2F3C2020200A3E65,$0A3E7370756F7247,$6F4E746F6F522F3C
    Data.b $64,$65,$3E
  Test_XML_UTF8_BOM_xml_end:

EndDataSection

Author:  oO0XX0Oo [ Sun Dec 10, 2017 9:38 pm ]
Post subject:  Re: Data Maker for OS X & Windows

If I use two bytes less than what is mentioned in the DataSection:
Code:
; size : 322 bytes
like so:
Code:
Debug PeekS(?Test_XML_UTF8_BOM_xml_start, 320, #PB_UTF8)


It shows the correct content (the .xml file including an empty line at the end
of it). Is there something that can be changed inside your Data Maker app
to be able to use -1 again or just do I have to live with this?

And if I may repost the question from my last posting:
Quote:
And a section question:
If I'd want to use a compression algo like LZMA, how
exactly would I decompress the data in the DataSection
and store it in a string afterwards?

Author:  J. Baker [ Sun Dec 10, 2017 9:44 pm ]
Post subject:  Re: Data Maker for OS X & Windows

I don't know what you used app-wize to create your xml. So it may have extra data. I could not use -1 on OS X and had to use the actual size. May be fine on Windows. Here's how to uncompress...
Code:
UseLZMAPacker()

*mem = AllocateMemory(363)
UncompressMemory(?Test_XML_UTF8_BOM_xml_start, 208, *mem, 363, #PB_PackerPlugin_Lzma)
Debug PeekS(*mem, 363, #PB_UTF8)
FreeMemory(*mem)

DataSection

  Test_XML_UTF8_BOM_xml_start:
    ; compressed size : 208 bytes [LZMA]
    ; original size : 363 bytes
    Data.q $0F1E00010000005D,$0F9166CED81187CB,$7FD4337BFDCA1E83,$6625763128DAB7E9,$29F76A6D092A4D20
    Data.q $14561DCCE7303870,$61261A52E899B9C3,$B17D6903E9A52C43,$654D37B4B9F130D1,$C37BA94E6DB50A06
    Data.q $F4B7DB5FB24B7DB3,$35D268862A4FEB39,$460BD42C9F0C4065,$49399DB617224B84,$B31E17517E787288
    Data.q $D761ACF02F779E4A,$5EB8C6F070A31A74,$3EFAAFD9C15FD99D,$D6FA333D21372F87,$65ED1A4D282B7403
    Data.q $C696B83F2AB3CF68,$C4A9F5A7A0197384,$F950E37E6B5B7C4B,$DBA2628CC20A4CB2,$7B8CC2E6AE2290A9
    Data.q $9A3497DA27708760
  Test_XML_UTF8_BOM_xml_end:

EndDataSection

Author:  oO0XX0Oo [ Sun Dec 10, 2017 10:12 pm ]
Post subject:  Re: Data Maker for OS X & Windows

Quote:
I don't know what you used app-wize to create your xml

Sublime Text but I tried the same with Notepad++ and Visual Studio Code
and for all three apps and the created DataSection I need to substract 2.
That doesn't seem to be app specific I'd say...

Code:
... your uncompress code...

Thank you for the code, it works fine!

Interestingly, when the data is packed I can use the sizes that the DataSection shows (no need to substract 2 bytes
like with non-compressed data)...

Code:
*mem = AllocateMemory(322)
UncompressMemory(?Test_XML_UTF8_BOM_xml_start, 215, *mem, 322, #PB_PackerPlugin_Lzma)
Debug PeekS(*mem, 322, #PB_UTF8)
FreeMemory(*mem)

DataSection

  Test_XML_UTF8_BOM_xml_start:
    ; compressed size : 215 bytes [LZMA]
    ; original size : 322 bytes
    Data.q $AE7700020000005D,$33B6EF81F9A3E3D3,$C7EECC17B56061B0,$24854427BCFAC066,$2E5315C83822A994
    Data.q $EF6E58998235DDE2,$7DC556C257F2E5FA,$18DCDE935C902E06,$6CB022BF20913C87,$22595EC629AEF1A7
    Data.q $64F789412BE7E895,$BBA8718AB1241EEB,$95C9943556B30D1F,$974FB56F6B3BABB0,$8E1A9D04B0A1B0E0
    Data.q $551E53A70AF2C414,$CDF2CEC10D955E41,$B15E4380F4DAB0A6,$437F75AE00D23E68,$E3F550B319BD7D53
    Data.q $DAF8A18BB1C35DF9,$59FDE79E2C0508F5,$7FB6CE0733699B36,$FE2A24A1B06359F4,$DDE0BC41E94350FA
    Data.q $5BD635961C8F46EF
    Data.b $D3,$57,$1B,$FE,$95,$85,$6B
  Test_XML_UTF8_BOM_xml_end:

EndDataSection

Page 1 of 2 All times are UTC + 1 hour
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/