Go to the
documentation of this file.
00001
00002
00003
00004
00005
00006
00007
00008 #pragma once
00009
00010 #include "..\compiler\parser.h"
00011
00012 class MSZipPackage;
00013 class DotRunParser;
00014 class MZPExtraction;
00015 class TabMZPExtraction;
00016
00017
00018
00019 class MZPExtraction
00020 {
00021 public:
00022 MSTR zip_name;
00023 MSTR extracted_name;
00024
00025 MZPExtraction(const MCHAR* zip_name, const MCHAR* extracted_name) :
00026 zip_name(zip_name), extracted_name(extracted_name) { }
00027 };
00028
00029 class TabMZPExtraction : public Tab<MZPExtraction*>
00030 {
00031 public:
00032 ~TabMZPExtraction();
00033
00034 MCHAR* find(const MCHAR* zip_name);
00035 void add(const MCHAR* zip_name, const MCHAR* extracted_name);
00036 };
00037
00038
00039 class MSZipPackage : public Value
00040 {
00041 public:
00042 enum clear_modes { CLEAR_NOW, CLEAR_ON_MAX_EXIT, CLEAR_ON_RESET, KEEP, };
00043
00044 MSTR file_name;
00045 MSTR package_name;
00046 MSTR description;
00047 int version;
00048 MSTR extract_dir;
00049 MSTR drop_file;
00050 TabMZPExtraction extractions;
00051 clear_modes clear_mode;
00052 WORD flags;
00053
00054 MSZipPackage(const MCHAR* file_name) : file_name(file_name), flags(0), clear_mode(CLEAR_ON_MAX_EXIT) { tag = INTERNAL_CLASS_TAG; }
00055
00056 void collect() { delete this; }
00057
00058
00059 ScripterExport static bool file_in_package(const MCHAR* file_name, MSTR* extract_dir=NULL);
00060 static int WINAPI output_callback(char far *buf, unsigned long size);
00061
00062
00063 ScripterExport static BOOL search_current_package(const MCHAR* file_name, MCHAR* found_path);
00064
00065
00066 bool extract_to(const MCHAR* dir);
00067 MCHAR* find_extraction(const MCHAR* zip_name) { return extractions.find(zip_name); }
00068 void add_extraction(const MCHAR* zip_name, const MCHAR* extracted_name);
00069
00070
00071 ScripterExport static MSTR expand_dir(const MCHAR* dir);
00072 ScripterExport static MSTR expand_file(const MCHAR* file_name);
00073 MSTR expand_dir_for_extraction(const MCHAR* dir);
00074 MSTR expand_file_for_extraction(const MCHAR* file_name);
00075
00076
00077 void run_all_scripts();
00078 bool run_script(const MCHAR* zip_name);
00079 };
00080
00081
00082 #define MZP_DONT_RUN 0x0001 // just loading, don't run any scripts
00083 #define MZP_HAVE_DROPFILE 0x0002 // 'drop' command encountered
00084 #define MZP_HAVE_OPEN 0x0004 // 'open' command encountered
00085
00086
00087 #define MZP_COPY 0x00
00088 #define MZP_MOVE 0x01
00089 #define MZP_FILES 0x00
00090 #define MZP_TREE 0x02
00091 #define MZP_NOREPLACE 0x04
00092
00093
00094 class DotRunParser : public Parser
00095 {
00096 MSZipPackage* mzp;
00097
00098 public:
00099
00100 DotRunParser (MSZipPackage* mzp) : mzp(mzp) { }
00101
00102
00103 bool interpret(const MCHAR* src);
00104
00105
00106 void name();
00107 void version();
00108 void description();
00109 void extract();
00110 void run();
00111 void drop();
00112 void open();
00113 void merge();
00114 void xref();
00115 void import();
00116 void copy(BYTE type);
00117 void clear();
00118 void keep();
00119
00120
00121 void copy_files(const MCHAR* from, const MCHAR* to, BYTE type);
00122 ScripterExport static bool create_dir(const MCHAR* dir);
00123 };
00124