Bin2Post - A file-to-forum-post encoder for PureBasic user

Applications, Games, Tools, User libs and useful stuff coded in PureBasic
User avatar
Kurzer
Enthusiast
Enthusiast
Posts: 666
Joined: Sun Jun 11, 2006 12:07 am
Location: Near Hamburg

Bin2Post - A file-to-forum-post encoder for PureBasic user

Post by Kurzer »

I already programmed this tool in 2013.

Today I updated it to the latest PureBasic version and realized that I never published it in the english forum. I want to do that with this post. :-)

It is a tool to prepare (small!) binary data in a way that you can embed them in text form here in the forum. The trick is that the embedded text already contains a decoder that converts the text back into a file using PureBasic. In practice you simply copy/paste the generated code into the IDE of PureBasic and press F5 - voi ala all is done.

--- Short-help ---
This program converts a binary file to a Base64 encoded string and
adds a small PureBasic source code to decode the string on a target
machine on which PureBasic must be installed. The added source code
ensures that the Base64 encoded string is decoded after it has been
copied into the PureBasics IDE and executed via the F5 key.
The original binary file will then be created on your hard disk.
A file requester pops up to choose a location to create the file on
your hard disk.
---

The reason why I wrote this tool at that time was that I found a very interesting program/project in the forum, but the associated linked file was no longer available, because the link to the filehost no longer worked. Too much time had passed and the filehoster had already deleted the file. A file, which is embedded directly in the post, remains permanently.

As I said, this is not about exchanging megabytes of large files, but rather about small files like in my example an icon that I can deliver directly in this post. The tool also makes sense if you transfer files via PN. The PN will be deleted after reading and so the forum server is not loaded.

Once again for the sake of understanding: The recipient does *not* need the tool for decoding. He just needs any PureBasic version from 4.31 to 5.70.

By using the Base64 encoding, the converted text will be about 30% larger than the original binary file. Therefore it makes sense to compress the file using ZIP, 7zip, Rar or similar before encode it with Bin2Post.

By the way, this tool saves storage space in the forum even with encoding pure program code.
The Bin2Post source code I posted below is 13493 bytes in size. If I would compress this source code with Zip and would encode it with Bin2Post, the resulting text would be only 6352 bytes long. This would save half of the required space in the forum post.


Okay, here are some screenshots, the source code and the corresponding Icon in "Bin2Post" format.

Kind Regards,
Kurzer

PS: Some comments in the source are in german, sorry for that.


Image

Image

Code: Select all

;*************************************************************************
;* Bin2Post
;*************************************************************************
;*
;* Programname       : Bin2Post
;* Filename          : Bin2Post.pb
;* Filetype          : Main [Main, Includefile, Datafile]
;* Programming lang. : Purebasic 4.61+
;* String-Format     : All [Ascii, Unicode, All]
;* Platform          : Windows [Windows, Mac, Linux, All]
;* Processor         : x86 [x86, x64]
;* Version           : 1.03
;* Date              : 16.04.2019
;* Autor             : Kurzer
;* -----------------------------------------------------------------------
;* English-Forum     : 
;* French-Forum      : 
;* German-Forum      : http://www.purebasic.fr/german/viewtopic.php?f=11&t=26298
;* -----------------------------------------------------------------------
;* DESCRIPTION:
;*
;* Wandelt eine binäre Datei in einen Base64-kodierten String um und fügt einen
;* kleinen PureBasic Sourcecode an. Der Sourcecode sorgt dafür, dass der gesamte
;* Base64-kodierte String dekodiert wird und die originale Binärdatei wieder auf
;* einem Laufwerk erzeugt wird. Der Base64-kodierte String (eigentlich ist es
;* Programmcode) kann per Copy/Paste in den PB Editor kopiert und dort gestartet
;* werden. Der User wird mittels SaveRequester gefragt, wo die Datei auf der 
;* Festplatte erzeugt werden soll.
;*
;* -----------------------------------------------------------------------
;* Historie:
;* 1.03 - fix 16.01.2019: Encoder- und Dekoderroutine an aktuelle PB Versionen angepasst.
;*                        Erfolgreich getestet wurden die PB Versionen 4.31 bis 5.70.
;*        add           : Checkbox für eine "Window on Top"-Funktion zugefügt.
;*        add           : Nach dem Start wird ein kurzer Hilfetext im Editorgadget angezeigt.
;* 1.02 - add 06.01.2017: Dekoderroutine verkürzt.
;* 1.01 - fix 05.01.2017: Programm Unicodefähig gemacht.
;* 1.00 - rel 22.01.2013: Erste Version.
;*************************************************************************
;* License: MIT License
;* 
;* Copyright (c) 2013/17/19 Kurzer
;* 
;* Permission is hereby granted, free of charge, to any person obtaining a copy
;* of this software and associated documentation files (the "Software"), to deal
;* in the Software without restriction, including without limitation the rights
;* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
;* copies of the Software, and to permit persons to whom the Software is
;* furnished to do so, subject to the following conditions:
;*
;* The above copyright notice and this permission notice shall be included in all
;* copies or substantial portions of the Software.
;* 
;* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
;* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
;* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
;* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
;* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
;* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
;* SOFTWARE.
;* 
;* ---------------- German translation of the MIT License ----------------
;*
;* MIT Lizenz:
;*
;* Hiermit wird unentgeltlich jeder Person, die eine Kopie der Software und der
;* zugehörigen Dokumentationen (die "Software") erhält, die Erlaubnis erteilt,
;* sie uneingeschränkt zu nutzen, inklusive und ohne Ausnahme mit dem Recht, sie
;* zu verwenden, zu kopieren, zu verändern, zusammenzufügen, zu veröffentlichen,
;* zu verbreiten, zu unterlizenzieren und/oder zu verkaufen, und Personen, denen
;* diese Software überlassen wird, diese Rechte zu verschaffen, unter den folgenden
;* Bedingungen:
;* 
;* Der obige Urheberrechtsvermerk und dieser Erlaubnisvermerk sind in allen Kopien
;* oder Teilkopien der Software beizulegen.
;* 
;* DIE SOFTWARE WIRD OHNE JEDE AUSDRÜCKLICHE ODER IMPLIZIERTE GARANTIE BEREITGESTELLT,
;* EINSCHLIEßLICH DER GARANTIE ZUR BENUTZUNG FÜR DEN VORGESEHENEN ODER EINEM BESTIMMTEN
;* ZWECK SOWIE JEGLICHER RECHTSVERLETZUNG, JEDOCH NICHT DARAUF BESCHRÄNKT. IN KEINEM
;* FALL SIND DIE AUTOREN ODER COPYRIGHTINHABER FÜR JEGLICHEN SCHADEN ODER SONSTIGE
;* ANSPRÜCHE HAFTBAR ZU MACHEN, OB INFOLGE DER ERFÜLLUNG EINES VERTRAGES, EINES DELIKTES
;* ODER ANDERS IM ZUSAMMENHANG MIT DER SOFTWARE ODER SONSTIGER VERWENDUNG DER SOFTWARE
;* ENTSTANDEN.
;*************************************************************************

EnableExplicit

Structure Settings
	iWindowSticky.i
	sFilename.s
	iFilesize.i
	iBase64Size.i
	*MemoryBuffer
	*Base64Buffer
	sText.s
EndStructure

#Version     = "V. 1.03 - 16 Apr. 2019"
#WelcomeMsg  = "Welome to the Bin2Post Converter (" + #Version + ") by Kurzer" + #LF$ + #LF$ + "This program converts a binary file to a Base64 encoded string and" + #LF$ + "adds a small PureBasic source code to decode the string on a target" + #LF$ + "machine on which PureBasic must be installed. The added source code" + #LF$ + "ensures that the Base64 encoded string is decoded after it has been" + #LF$ + "copied into the PureBasics IDE and executed using the F5 key." + #LF$ + "The original binary file will then be created on your hard disk." + #LF$ + "A file requester pops up to choose a location to create the file on" + #LF$ + "your hard disk." + #LF$ + #LF$ + "Please simply drop a file into this area to encode it to a Base64 string."

#Rowlen      = 110			; Zeilenbreite der generierten Datazeilen in Zeichen
#MaxEntries  = 10000		; Maximale Anzahl der im Editorgadget angezeigten Zeilen
#MaxFilelen  = 500000		; Maximale Größe der zu konvertierenden Datei in Bytes
#RefreshRate = 500			; Anzahl bearbeiteter Bytes bis die Statusanzeige (x von y Bytes) refreshed wird

Define iEvent.i, iEventGadget.i, iEventType.i, iQuit.i
Global Bin2Post.Settings

;*************************************************************************
;* Procedures
;*************************************************************************

Procedure   Convert(sFilename.s)
	Protected j.i, iLength.i
	
	iLength = #Rowlen
	Bin2Post\sText = ""
	
	Bin2Post\iFilesize = FileSize(sFilename)
	If Bin2Post\iFilesize > 0 And Bin2Post\iFilesize <= #MaxFilelen
		Bin2Post\MemoryBuffer = AllocateMemory(Bin2Post\iFilesize)
		Bin2Post\Base64Buffer = AllocateMemory(Bin2Post\iFilesize * 1.5)
		
		If Bin2Post\MemoryBuffer > 0 And Bin2Post\Base64Buffer > 0
			If OpenFile(0, sFilename)
				If ReadData(0, Bin2Post\MemoryBuffer, Bin2Post\iFilesize) > 0
					
					SetGadgetText(2, "Converting to Base64 Format")
					CompilerIf #PB_Compiler_Version >= 560
						Bin2Post\iBase64Size = Base64EncoderBuffer(Bin2Post\MemoryBuffer, Bin2Post\iFilesize, Bin2Post\Base64Buffer, Bin2Post\iFilesize * 1.5)
					CompilerElse
						Bin2Post\iBase64Size = Base64Encoder(Bin2Post\MemoryBuffer, Bin2Post\iFilesize, Bin2Post\Base64Buffer, Bin2Post\iFilesize * 1.5)
					CompilerEndIf
					
					; Header erzeugen
					Bin2Post\sText = "; This PureBasic sourcecode was generated by Bin2Post (" + #Version + "), a file converter for sharing binary" + #LF$
					Bin2Post\sText + "; files in text based forums. More Information see: www.purebasic.fr/german/viewtopic.php?f=11&t=26298 or see here:" + #LF$
					Bin2Post\sText + "; www.purebasic.fr/english/viewtopic.php?f=27&t=72656. Copy/paste this code into your PureBasic IDE and run it via" + #LF$
					Bin2Post\sText + "; F5 (PB 4.31 - 5.70 is needed). You'll be asked for a directory where the script creates the original binary file." + #LF$
					Bin2Post\sText + "; Filename: " + GetFilePart(sFilename) + " - Binary filesize: " + Str(Bin2Post\iFilesize) + " bytes - Base64 encoded size: " + Str(Bin2Post\iBase64Size) + " chars" + #LF$
					Bin2Post\sText + ";" + #LF$
					Bin2Post\sText + "Macro D:I$+:EndMacro:L=" + Str(Bin2Post\iBase64Size) + ":" + "F$=SaveFileRequester(" + #DQUOTE$ + "Save file" + #DQUOTE$ +"," + #DQUOTE$ + GetFilePart(sFilename) + #DQUOTE$ + "," + #DQUOTE$ + "All (*.*)|*.*" + #DQUOTE$ + ",0):If F$<>" + #DQUOTE$ + #DQUOTE$ + #LF$
					
					; Datenblock erzeugen
					For j = 0 To Bin2Post\iBase64Size Step #Rowlen
						If j % #RefreshRate = 0
							SetGadgetText(2, "Generating data blocks [" + Str(j) + " / " + Str(Bin2Post\iBase64Size)+ "]")
							While WindowEvent() : Wend
						EndIf
						If j + #Rowlen >= Bin2Post\iBase64Size : iLength = Bin2Post\iBase64Size - j : EndIf
						If iLength > 0
							Bin2Post\sText + "D" + Chr(34) + PeekS(Bin2Post\Base64Buffer + j, iLength, #PB_Ascii) + Chr(34) + #LF$
						EndIf
					Next j
					
					; Footer erzeugen
; 					Bin2Post\sText + "CompilerIf #PB_Compiler_Version >= 560:*O=AllocateMemory(L):OL=Base64Decoder(I$,*O,L):If CreateFile(0,F$)" + #LF$
; 					Bin2Post\sText + "WriteData(0,*O,OL):CloseFile(0):FreeMemory(*O):CompilerElse:*O=AllocateMemory(L*2):PokeS(*O,PeekS(@I$),-1,#PB_Ascii)" + #LF$
; 					Bin2Post\sText + "OL=Base64Decoder(*O,L,*O+L,L):If CreateFile(0,F$):WriteData(0,*O+L,OL):FreeMemory(*O):CompilerEndIf:EndIf:EndIf"
					
					Bin2Post\sText + "*O=AllocateMemory(L*2):CompilerIf #PB_Compiler_Version >= 560:OL=Base64Decoder(I$,*O+L,L):CompilerElse" + #LF$
					Bin2Post\sText + "PokeS(*O,PeekS(@I$),-1,#PB_Ascii):OL=Base64Decoder(*O,L,*O+L,L):CompilerEndIf:If OL=" + Str(Bin2Post\iFilesize) + " And CreateFile(0,F$)" + #LF$
					Bin2Post\sText + "WriteData(0,*O+L,OL):CloseFile(0):EndIf:FreeMemory(*O):EndIf"

					If Bin2Post\iBase64Size > #MaxEntries
						SetGadgetText(0, Left(Bin2Post\sText, 4096) + #LF$ + "... more lines were encoded. Please use the 'Copy' button to copy the complete encoded string to the clipbard.")
					Else
						SetGadgetText(0, Bin2Post\sText)
					EndIf
					SetGadgetText(2, "Conversion finished (" + Str(Bin2Post\iBase64Size) + " Bytes total)")
					
				EndIf
				CloseFile(0)
			EndIf
			FreeMemory(Bin2Post\Base64Buffer)
			FreeMemory(Bin2Post\MemoryBuffer)
		EndIf
	ElseIf Bin2Post\iFilesize > #MaxFilelen
		SetGadgetText(2, "Filesize exceed the limit of " + Str(#MaxFilelen) + " Bytes!")
	EndIf
	
EndProcedure

;*************************************************************************
;* Main
;*************************************************************************

If OpenWindow(0, #PB_Ignore, #PB_Ignore, 410, 250, "Bin2Post Converter " + #Version, #PB_Window_ScreenCentered | #PB_Window_SizeGadget | #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
	SmartWindowRefresh(0, 1)
	StickyWindow(0, #True)
	
	EditorGadget(0, 10, 10, WindowWidth(0) - 20, WindowHeight(0) - 45, #PB_Editor_ReadOnly)
	SetGadgetColor(0, #PB_Gadget_BackColor, $F2F2F2)
	EnableGadgetDrop(0, #PB_Drop_Files, #PB_Drag_Copy)
	CheckBoxGadget(1, 10, WindowHeight(0) - 35, 110, 20, "Window on top")
	TextGadget(2, 10, WindowHeight(0) - 17, WindowWidth(0) -80, 20, "Drop a file into the light gray area to encode the file.")
	ButtonGadget(3, WindowWidth(0) - 70, WindowHeight(0) - 30, 60, 28, "Copy")
	SetGadgetText(0, #WelcomeMsg)
	
	
	SetGadgetState(1, #PB_Checkbox_Checked)
	
	Repeat
		iEvent = WaitWindowEvent()
		iEventGadget = EventGadget()
		iEventType = EventType() 
		
		Select iEvent
			Case #PB_Event_SizeWindow
				ResizeGadget(0, 10, 10, WindowWidth(0) - 20, WindowHeight(0) - 45)
				ResizeGadget(1, 10, WindowHeight(0) - 35, 110, 20)
				ResizeGadget(2, 10, WindowHeight(0) - 17, WindowWidth(0) - 80, 20)
				ResizeGadget(3, WindowWidth(0)- 70, WindowHeight(0) - 30, 60, 28)
			Case #PB_Event_GadgetDrop
				Select iEventGadget
					Case 0
						If EventDropType() = #PB_Drop_Files And EventDropAction() = #PB_Drag_Copy
							Bin2Post\sFilename = StringField(EventDropFiles() + #LF$, 1, #LF$)
							Convert(Bin2Post\sFilename)
						EndIf
				EndSelect
			Case #PB_Event_Gadget
				Select iEventGadget
					Case 1
						StickyWindow(0, GetGadgetState(1) & #PB_Checkbox_Checked)
					Case 3
						SetClipboardText(Bin2Post\sText)
						SetGadgetText(2, "The complete text was copied to clipboard (" + Str(Bin2Post\iBase64Size) + " Bytes total)")
				EndSelect
			Case #PB_Event_CloseWindow
				iQuit = 1
		EndSelect
	Until iQuit = 1
EndIf
End 
Here you'll find the programm icon:

Code: Select all

; This PureBasic sourcecode was generated by Bin2Post (V. 1.03 - 16 Apr. 2019), a file converter for sharing binary
; files in text based forums. More Information see: www.purebasic.fr/german/viewtopic.php?f=11&t=26298 or see here:
; www.purebasic.fr/english/viewtopic.php?f=27&t=72656. Copy/paste this code into your PureBasic IDE and run it via
; F5 (PB 4.31 - 5.70 is needed). You'll be asked for a directory where the script creates the original binary file.
; Filename: Bin2Post.ico - Binary filesize: 3774 bytes - Base64 encoded size: 5032 chars
;
Macro D:I$+:EndMacro:L=5032:F$=SaveFileRequester("Save file","Bin2Post.ico","All (*.*)|*.*",0):If F$<>""
D"AAABAAEAMDAAAAEACACoDgAAFgAAACgAAAAwAAAAYAAAAAEACAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAEAwQAB4N0AJSEdwAOzbYAfIKEAA"
D"ekigBFxa8AEkQyAGRqbAAEg/wAFHK0AASt/ABM6qQABGdKACyEcAAspJEADuXMACRmNAAskmwAM7KLACzClACExsQAZOPMACZlXAAswuwAZMK8"
D"AEnj2QBEwvwAJoTlACrVvgAsXjwALKrUABRWXAAplZQADFY8ACmFgAA1pIkAR9S+ACu0nwAkdGIAnKKZADrEqgAqtfoAzNLUALWFiwBR9t8AKH"
D"NPADe1ogA3xLQALJ68ACyLcQA1lH8ADCgQADV+agAElfcAFGbkAFL0wgAhVDgAVtTEAJaUigArpfAANKSsANfu9wAHk3kANryjACJ07wAsq/AA"
D"JHKEAB5VRgA2rZcAJ2VPAAe1lwBW4soAK31pADjTsADv8ewAKGtRAEymnAAcRTAABHJUADSFbwA84rwATNbkACyM6QArrJYAWOvYADSdjQBJ28"
D"QAUf7sADjMuQBIrugAK5uDADnMpgAkLiwAmJ2TABqaiAA3va0AI33oAETKnABk+twAPNTgABeY9wAhXEgAPNq/APz+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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
D"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
D"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA"
*O=AllocateMemory(L*2):CompilerIf #PB_Compiler_Version >= 560:OL=Base64Decoder(I$,*O+L,L):CompilerElse
PokeS(*O,PeekS(@I$),-1,#PB_Ascii):OL=Base64Decoder(*O,L,*O+L,L):CompilerEndIf:If OL=3774 And CreateFile(0,F$)
WriteData(0,*O+L,OL):CloseFile(0):EndIf:FreeMemory(*O):EndIf
Last edited by Kurzer on Tue Apr 16, 2019 6:56 pm, edited 2 times in total.
PB 6.02 x64, OS: Win 7 Pro x64 & Win 11 x64, Desktopscaling: 125%, CPU: I7 6500, RAM: 16 GB, GPU: Intel Graphics HD 520, User age in 2024: 56y
"Happiness is a pet." | "Never run a changing system!"
Dude
Addict
Addict
Posts: 1907
Joined: Mon Feb 16, 2015 2:49 pm

Re: Bin2Post - A file-to-forum-post encoder for PureBasic us

Post by Dude »

Works great, thanks! :) Created your Kermit icon on my desktop with no problem.
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5353
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: Bin2Post - A file-to-forum-post encoder for PureBasic us

Post by Kwai chang caine »

Me too, thanks for sharing 8)
ImageThe happiness is a road...
Not a destination
Post Reply