22.11.2012 - Be sure to check our currently running annual FBGD game making competition. This year's theme is SEASONS OF THE YEAR, 300 $ first place prize, and the competition runs till 18th of February. Link: http://games.freebasic.net/forum/index.php?topic=559.0
I've wrote simple package manager which supports encryption, it's called Packer and it's placed inside FB namespace (and thats why it's called FB.Packer)...
package.ExtractFile "txt file", "extracted.txt" ' unpack to extracted.txt package.ExtractFile "bmp file", "extracted.bmp" ' unpack to extracted.bmp
simple, isn't it?
FB.Packer methods:
Sub Packer.AddFile(Name As String, Filename As String) -- Adds new file to package, data is read from file. If item with specified Name already exists it will be overwritten
Sub Packer.AddFile(Name As String, pData As UByte Pointer, length As Integer) -- Adds new file to package, data is read from memory. If item with specified Name already exists it will be overwritten
Sub Packer.ExtractFile(Name As String, OutputFile As String) -- Extracts file from package to file
Sub Packer.ExtractFile(Name As String, pData As UByte Pointer, ByRef length As Integer) -- Extracts file from package to memory
Sub Packer.Remove(Name As String) -- Removes file from package
Sub Packer.Clear -- Removes all files from package
Sub Packer.Save(Filename As String, Password As String) -- Writes package to file and encrypts data using provided password
Sub Packer.Load(Filename As String, Password As String) -- Loads package from file and decrypts data using provided password
FB.Packer properties:
Encrypt As CryptFunction -- sets function used for encryption (defaults to RC4 algorithm which is included in fbpacker.bi)
Decrypt As CryptFunction -- sets function used for decryption (defaults to RC4 algorithm which is included in fbpacker.bi)