File Format Remarks =================== IPW Files and IPZ Files ----------------------- IPW files are based on the Compound File Binary Format of Microsoft (also called Microsoft COM Structured Storage), see also https://en.wikipedia.org/wiki/Compound_File_Binary_Format. This format is also used for Microsoft Excel XLS files. Compound files are made up of storages. A Storage can contain streams (files) with user data and storages. The file size is limited to 2 GB. The Compound-File-Format supports transactions. This means that a modification to a file will be saved with a commit. If the commit fails the original file is not altered. IPZ files are based of the UPDF file format, see :ref:`overview-UPDF-files`. .. index:: Autosave Autosave ............................ IPZ files are automatically saved from time to time. To this end the subfolder ``AutoSave`` of the UniPlot User folder (see :ref:`GetUserDirectory`) is used. .. highlightlang:: us :: GetUserDirectory(1) + "AutoSave\\" // C:\Users\\AppData\Local\UniPlot\AutoSave\ .. _copy-on-open: Copy On Open ............................ UniPlot uses random access to load a document file. When a document is opened, only the data of the current page is loaded. New pages loaded, if the page is selected for the first time. This type of access if optimal to access the file from a local hard drive, SSD drive, USB drive or USB stick. For files, saved on a slow network drive the sequential access has a much better performance than the random access. In UniPlot R2016 IPZ documents saved on a network drive are copied to the local drive. After the modified document is closed, it will be copied back in the the original folder on the network. This optional technic is not used for IPW files. While the IPZ document is open, the file on the network drive will be locked, to avoid that another process tries to modify the file. If the IPZ file is larger than 1MB a progress dialog box will be displayed for opening and saving the file. While the file is edited, other users can only open a copy of the file. Used files: * Source file: IPZ file on a network drive. * lock file: Is a text file that contains the user and computer name and the UUID of the file in the local storage. The name is identical to IPZ file with the extension ``.lock``: .. highlightlang:: none :: sami@vostroi7 2016-03-04 (5) 10:33:50,236 c4b3efab-ea87-4d47-b6d9-a3df8c54be62 * bak file: * UUID file: Copy of the source file. The UUID file will be saved in the folder ``LocalStore`` in the UniPlot User folder (see :ref:`GetUserDirectory`). The file name is a UUID (see :ref:`uuid`). * jnl file: The journal file ist created when the IPZ file is opened and removed, when the IPZ file is closed. In case of an error or power loss, the journal file is not deleted. The next time UniPlot attempts to open the IPZ file, it notices the presence of the abandoned journal and uses the information to restore the IPZ file. * info file: Text file in ``LocalStore`` with the source file name including the path. The file name is the UUID with the extension ``.info``. Another user can only open a copy of the the IPZ file on the network. The second user will be asked if they want to open a copy of the file. The file name will be displayed as "Name (Copy).ipz" When the copy is saved the message box "Saved modified? - Yes/No" will be displayed. No: The local uuid file will be closed and the lock file on the network drive will be closed and deleted, The UUID file and info file will be deleted as well. Yes: 1. The uuid file will be saved and closed (Commit). The following steps will be executed in UniPlot (with progress bar) or executed as a separate background process. 2. Compress the UUID file with :ref:`ipz_pack`. 3. Copy the the UUID into the network folder of the source file. 4. remove ``source.bak`` is available. 5. Rename the source file to ``source.bak``. 6. Rename the new UUID file to ``source.ipz``. 7. Close lock file and delete it. 8. Remove bak file (optional). Problems: Possible data loss, if the "Use background process to save the document" is enabled and the local computer is switched off while the background process is copying the file to the network drive. In this case the modified file is only in ``LocalStore``. Possibilities to avoid problem: * The background process displays a progress dialog box. * UniPlot will not to close its main window until all background processes have finished. An info message is displayed: "Please wait until all files are saved. Exit anyway?" Error handling: * IPZ files are edited and the network plug is pulled: The files must be saved in new folders. * Terminate UniPlot with the Task-Manager or power failure: All files in the ``LocalStore`` are loaded, when UniPlot is started the next time and the autosave information is applied. Options: copy-on-open: (Default: TRUE) Enabled: UniPlot documents saved on a network drive are copied onto the local computer. Disabled: UniPlot documents saved on a network drive are opened directly. save-with-background-proccess: (Default: FALSE) remove-bak-file: (Default: FALSE) :sub:`id-1235746`