[url removed, login to view] provide the [url removed, login to view] utility (as part of the TCPIP application library) to turn a normal folder of files into a unique single .bin file containing the original files but in the MPFS2 file format.
This job is to create a standalone windows executable that will allow the user to select a folder and a destination [url removed, login to view] and have the selected folder contents converted into the above file format
A standalone windows utility compatible with Windows XP and up written in C# or [url removed, login to view]
Convert the contents of a selected windows folder and convert it into a single file containing the contents of the selected windows folder but in the [url removed, login to view] TCPIP Application library compatible 'MPFS2' file system.
A single form application titled 'MPFS2 Generator'
Form has this interaction:
Allow user to browse for a source folder, display source folder once selected
- Labelled 'Source folder'
Allow user to specify a target [url removed, login to view] destination output file, display including path if specified
- Labelled 'Destination'
- will overwrite existing file at same destination/name if exists, no prompt necessary
- enable 'Generate' button only when Source folder and destination above identified/selected
- refer below for on click functionality
Message area (labelled 'Log')
- A vertically scrollable message area
- Each message is on its own line
- Each message is prefixed by date time in the format dd/mm/yy hh:mm or mm/dd/yy hh:mm depending on the users local time settings
- Messages are ordered by earliest first
Note: The source folder is allowed to contain sub folders
Note: For the purposes of the following specification, for any file contained in the source folder, it's filename is the relative path to the file including the file name and file extension
If the user selected c:\xxx\ as the source folder, and file c:\xxx\yyy\[url removed, login to view] exists, 'yyy\[url removed, login to view]' is its filename
Generate button on click:
1. Clear the Message area
2. Perform preparser checks:
- for each file in the source file
- - check the filenames are all <= 64 characters
- - If any filenames are > 64 characters output a first message to the message area 'Generation failed'
- - - For each file where relative path is > 64 characters output a message to the message area in the format:
'ffffff > 64 characters' where fffff is the filename
- - - End processing
3. Parse the source folder into the MPFS2 file format.
- Outputs destination .bin file
- Contains each file from the source folder
- Adheres to the MPFS2 file format per below
On completion, output a message to the message area 'Generation complete'
From the Microchip TCPIP Application Library, MPFS2.c file:
* MPFS Structure:
* [BYTE Ver Hi][BYTE Ver Lo][WORD Number of Files]
* [Name Hash 0][Name Hash 1]...[Name Hash N]
* [File Record 0][File Record 1]...[File Record N]
* [String 0][String 1]...[String N]
* [File Data 0][File Data 1]...[File Data N]
* Name Hash (2 bytes):
* hash = 0
* for each(byte in name)
* hash += byte
* hash <<= 1
* Technically this means the hash only includes the
* final 15 characters of a name.
* File Record Structure (22 bytes):
* [DWORD String Ptr][DWORD Data Ptr]
* [DWORD Len][DWORD Timestamp][DWORD Microtime]
* [WORD Flags]
* Pointers are absolute addresses within the MPFS image.
* Timestamp is the UNIX timestamp
* Microtime is currently unimplemented
* String Structure (1 to 64 bytes):
* ["path/to/[url removed, login to view]"][0x00]
* File Data Structure (arbitrary length):
* [File Data]
* Unlike previous versions, there are no delimiters.
* Name hash is calculated as follows:
* hash = 0
* for each(byte in name)
* hash += byte, hash <<= 1
* Current version is 2.1
Notes on the above:
DWORD is 4 bytes
WORD 2 bytes
WORD Flags is always 00
Attached is [url removed, login to view] & [url removed, login to view] & MPFS2Img.c
[url removed, login to view] is a source folder webpages2\
[url removed, login to view] is the above source folder after conversion into the MPFS2 filesystem using Microchips own utility with 2 files that were processed using Microchips own utility [url removed, login to view]
The utility this vcoder job is for would create an identical [url removed, login to view] from [url removed, login to view]
MPFS2Img.c is the result of an additional step Microchip's own [url removed, login to view] utility performs which is creating the [url removed, login to view] file contents but as inline C. It is useful as it shows the individual byte level output of the expected conversion process.