MosASCII Project Workspace/File Format (MPW/MPF) 1.0B Written by Robert DeFusco This document contains information about the MosASCII Project file format. There are 2 extensions for this file. The first is MPF, MosASCII Project File. Due to a conflict with Microsoft Design Gallery files (MPF), I have changed the extension to MPW, MosASCII Project Workspace. All references to the file format will use the MPW extension. Please note, MPW and MPF files contain the same data format, including the same file ID header. OVERVIEW --------- MosASCII Project Workspace files are used by MosASCII to store project information, such as source image, custom text, font size, output mode, and other settings. MPW files are used to save your projects for backup purposes, or to send them to family/friends over the internet, as it is more efficient to send a compressed MPW file, rather than a large HTML mosaic. MPW FORMAT OVERVIEW ------------ MPF10000 (HEADER ID, 8 BYTE) COMPRESSED DATA (ANY SIZE) HEADER ID --------- MPW file headers start with "MPF", then are followed by the version of MosASCII. The header ID must be 8 bytes. MPF10000 = Version 1.0.000 Version information must be stored in the format #.#.###, with the decimals removed. Therefore 1.0.000 = 10000, and 2.5.150 = 25150 COMPRESSED DATA --------------- The compressed data in an MPW file is compressed using the Catalyst File Encoding ActiveX Control, CSFED32.OCX. READING THE FILE ---------------- You must first read the header. If bytes 1,2,3 are not M,P,F the file is invalid. Next you must load the version information, this is used for compatibility with older versions of MosASCII. EXAMPLE CODE (BASIC) Dim sMPFHeader As String * 8 Dim F as Variant F = FreeFile Open sFileName For Binary Access Read As F Get #F, , sMPFHeader Close F sMPFHeader = Trim(sMPFHeader) If Left(sMPFHeader, 3) = "MPF" Then Dim lVersion As Long lVersion = CLng(Right(sMPFHeader, Len(sMPFHeader) - 3)) If lVersion < 10000 Then MsgBox "You are using an older version than 1.0.000!" Else MsgBox "Invalid MPW File!" End If To load the compressed data, simply go from byte 9 to EOF, then write that data to a temporary file. Pass this file location to the CSFED32.OCX ExpandFile function. EXAMPLE CODE (BASIC) sFileData = Right(sFileData, Len(sFileData) - 8) F = FreeFile Open "temp.000" For Output As F Print #F, sFileData Close F Call FileEncoder1.ExpandFile("temp.000", "temp.001") Kill "temp.000" ' first temp file (contained compressed data) is no longer needed Dim sMPFOutputFile As String * 265 ' Output File, no longer used but reserved ' for compatibility (265 BYTES) Dim sMPFPageCaption As String * 512 ' Page Caption text (512 BYTES) Dim sMPFBGColor As String * 8 ' Background Color data (RGB LONG) (8 BYTES) Dim sMPFFontSize As String * 2 ' Font Size (2 BYTES) Dim sMPFCSSFontSize As String * 6 ' Custom CSS Font Size (6 BYTES) Dim sMPFSpacer As String * 2 ' Spacer Character (2 BYTES) Dim sMPFMode As String * 2 ' Output Mode (2 BYTES) Dim sMPFOIB As String * 1 ' Open in browser, no longer used but reserved ' for compatibility (1 BYTE) Dim sMPFSizeOfCT As String * 8 ' Size of custom text data (8 BYTES) Dim sMPFSizeOfID As String * 8 ' Size of image data (8 BYTES) F = FreeFile Open "temp.001" For Binary Access Read As F Get #F, , sMPFOutputFile Get #F, (265 + 2) + 1, sMPFPageCaption Get #F, (265 + 512 + 2 + 2) + 1, sMPFBGColor Get #F, (265 + 512 + 8 + 2 + 2 + 2) + 1, sMPFFontSize Get #F, (265 + 512 + 8 + 2 + 2 + 2 + 2 + 2) + 1, sMPFCSSFontSize Get #F, (265 + 512 + 8 + 2 + 2 + 2 + 2 + 6 + 2 + 2) + 1, sMPFSpacer Get #F, (265 + 512 + 8 + 2 + 2 + 2 + 2 + 6 + 2 + 2 + 2 + 2) + 1, sMPFMode Get #F, (265 + 512 + 8 + 2 + 2 + 2 + 2 + 2 + 6 + 2 + 2 + 2 + 2 + 2) + 1, sMPFOIB Get #F, (265 + 512 + 8 + 2 + 2 + 2 + 2 + 1 + 6 + 2 + 2 + 2 + 2 + 2 + 2 + 2) + 1, sMPFSizeOfCT Get #F, (265 + 512 + 8 + 2 + 2 + 2 + 2 + 1 + 8 + 6 + 2 + 2 + 2 + 2 + 2 + 2 + 2 + 2) + 1, sMPFSizeOfID Close F You will now have the uncompressed project data, the data is as follows. PLEASE NOTE: All data fields have a set size in bytes, if the actual data does not reach the set size the data will be followed by space characters (0x32). Because of this, when using the data, please trim all trailing spaces from the data field. If BASIC you can use the TRIM$(FieldName) function. sMPFOutputFile (265 BYTES), contains the directory that the projects Output Directory was set to sMPFPageCaption (512 BYTES), contains the page caption text of the HTML mosaic, this is the data that goes in the