Mercurial > vba-clojure
diff src/win32/7zip/OpenArchive.h @ 1:f9f4f1b99eed
importing src directory
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Sat, 03 Mar 2012 10:31:27 -0600 |
parents | |
children |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/src/win32/7zip/OpenArchive.h Sat Mar 03 10:31:27 2012 -0600 1.3 @@ -0,0 +1,43 @@ 1.4 +// for retrieving files from archives and/or managing temporary files 1.5 + 1.6 +#ifndef OPENARCHIVE_HEADER 1.7 +#define OPENARCHIVE_HEADER 1.8 + 1.9 +#include "7zip.h" 1.10 + 1.11 +// ObtainFile() 1.12 +// this is the main, high-level function for opening possibly-compressed files. 1.13 +// you don't need to check whether the file is compressed beforehand, 1.14 +// this function will figure that out and work correctly either way. 1.15 +// it also does the work of bringing up a within-archive file selector dialog if necessary, 1.16 +// which even allows navigating to a file within an archive that's within the archive. 1.17 +// the output PhysicalName is the filename of an uncompressed file 1.18 +// for you to load with fopen or whatever, 1.19 +// unless the function fails (or is cancelled) in which case it will return false. 1.20 +// example input Name: "C:\games.zip" 1.21 +// example output LogicalName: "C:\games.zip|Metroid.gba" 1.22 +// example output PhysicalName: "C:\Documents and Settings\User\Local Settings\Temp\VBA\rom7A37.gba" 1.23 +// assumes the three name arguments are distinct character buffers with exactly 2048 bytes each 1.24 +bool ObtainFile(const char* Name, char *const & LogicalName, char *const & PhysicalName, const char* category=NULL, const char** ignoreExtensions=NULL, int numIgnoreExtensions=0); 1.25 + 1.26 +// ReleaseTempFileCategory() 1.27 +// this is for deleting the temporary files that ObtainFile() can create. 1.28 +// using it is optional because they will auto-delete on proper shutdown of the program, 1.29 +// but it's nice to be able to clean up the files as early as possible. 1.30 +// pass in the same "category" string you passed into ObtainFile(), 1.31 +// and this will delete all files of that category. 1.32 +// you can optionally specify one filename to not delete even if its category matches. 1.33 +// note that any still-open files cannot be deleted yet and will be skipped. 1.34 +void ReleaseTempFileCategory(const char* category, const char* exceptionFilename=NULL); 1.35 + 1.36 +// sets the parent window of subsequent archive selector dialogs 1.37 +// NULL resets this to the default (main VBA emulator window) 1.38 +void SetArchiveParentHWND(void* hwnd=NULL); 1.39 + 1.40 +// the rest of these are more internal utility functions, 1.41 +// but they could be generally useful outside of that 1.42 +const char* GetTempFile(const char* category=NULL, const char* extension=NULL); // creates a temp file and returns a path to it. extension if any should include the '.' 1.43 +void ReleaseTempFile(const char* filename); // deletes a particular temporary file, by filename 1.44 +int ChooseItemFromArchive(ArchiveFile& archive, bool autoChooseIfOnly1=true, const char** ignoreExtensions=0, int numIgnoreExtensions=0); // gets an index to a file within an already-open archive, using the file chooser if there's more than one choice 1.45 + 1.46 +#endif