Patch level : 2.0 664
Files correlati : xvaga.dll Ricompilazione Demo : [ ] Commento : EP20155 I tasti Alt+Lettera non funzionano quando sono attive le maisucole. git-svn-id: svn://10.65.10.50/trunk@11682 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									bdefc688c6
								
							
						
					
					
						commit
						4a6fff7e3a
					
				| @ -11,6 +11,7 @@ | |||||||
| // Unzip support
 | // Unzip support
 | ||||||
| ///////////////////////////////////////////////////////////
 | ///////////////////////////////////////////////////////////
 | ||||||
| 
 | 
 | ||||||
|  | #include <wx/dir.h> | ||||||
| #include <wx/wfstream.h> | #include <wx/wfstream.h> | ||||||
| #include <wx/zipstrm.h> | #include <wx/zipstrm.h> | ||||||
| 
 | 
 | ||||||
| @ -144,44 +145,16 @@ public: | |||||||
|   AgaZlibOutputStream(wxOutputStream& stream); |   AgaZlibOutputStream(wxOutputStream& stream); | ||||||
| }; | }; | ||||||
| 
 | 
 | ||||||
| #if wxCHECK_VERSION(2,3,4) | // Ricordarsi di taroccare il sorgente della deflateInit in zlib
 | ||||||
| 
 |  | ||||||
| // Da questa vesrione si deve taroccare il sorgente della deflateInit in zlib
 |  | ||||||
| AgaZlibOutputStream::AgaZlibOutputStream(wxOutputStream& stream) | AgaZlibOutputStream::AgaZlibOutputStream(wxOutputStream& stream) | ||||||
|                    : wxZlibOutputStream(stream, AGA_COMPRESSION_LEVEL) |                    : wxZlibOutputStream(stream, AGA_COMPRESSION_LEVEL) | ||||||
| { } | { } | ||||||
| 
 | 
 | ||||||
| #else |  | ||||||
| 
 | 
 | ||||||
| AgaZlibOutputStream::AgaZlibOutputStream(wxOutputStream& stream) | static size_t AddFilesToList(const wxString& strBase, const wxString& strMask, wxArrayString& aFiles) | ||||||
| : wxZlibOutputStream(stream, AGA_COMPRESSION_LEVEL) |  | ||||||
| { | { | ||||||
| 	const int DEF_MEM_LEVEL = 8; |   const size_t n = wxDir::GetAllFiles(strBase, &aFiles, strMask); | ||||||
|   deflateInit2_(m_deflate, AGA_COMPRESSION_LEVEL, Z_DEFLATED, -MAX_WBITS, DEF_MEM_LEVEL, |   return n; | ||||||
| 			 Z_DEFAULT_STRATEGY, "1.1.2", sizeof(*m_deflate)); |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| static int AddFilesToList(const wxString& strBase, const wxString& strMask, wxStringList& aFiles) |  | ||||||
| { |  | ||||||
| 	int n = 0; |  | ||||||
|   wxString f = strBase + "/" + strMask; |  | ||||||
|   f = ::wxFindFirstFile(f, 0); |  | ||||||
|   while (!f.IsEmpty()) |  | ||||||
| 	{ |  | ||||||
| 		if (wxDirExists(f)) |  | ||||||
| 		{ |  | ||||||
| 			n += AddFilesToList(f, strMask, aFiles); |  | ||||||
| 		} |  | ||||||
| 		else |  | ||||||
| 		{ |  | ||||||
| 		  aFiles.Add(f); |  | ||||||
| 			n++; |  | ||||||
| 		} |  | ||||||
| 		f = ::wxFindNextFile(); |  | ||||||
| 	} |  | ||||||
| 	return n; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static void AddFileToZip(const wxString& strPrefix, const wxString& strFile, | static void AddFileToZip(const wxString& strPrefix, const wxString& strFile, | ||||||
| @ -214,7 +187,7 @@ static void AddFileToZip(const wxString& strPrefix, const wxString& strFile, | |||||||
| 	fout.Write((const char*)strRelName, zlfh.nNameLength); // Scrivo nome file
 | 	fout.Write((const char*)strRelName, zlfh.nNameLength); // Scrivo nome file
 | ||||||
| 
 | 
 | ||||||
|  	const off_t nDataStart = fout.TellO();              // Memorizzo posizione dati compressi
 |  	const off_t nDataStart = fout.TellO();              // Memorizzo posizione dati compressi
 | ||||||
| 	const int nMagicOffset =  -4; // Deep hacking :-)
 | 	const int nMagicOffset = -4; // Deep hacking :-)
 | ||||||
| 	 | 	 | ||||||
| 	{ | 	{ | ||||||
|   	wxFileInputStream fin(strFile); |   	wxFileInputStream fin(strFile); | ||||||
| @ -258,7 +231,7 @@ static void AddFileToZip(const wxString& strPrefix, const wxString& strFile, | |||||||
|   fdir.Write((const char*)strRelName, strRelName.Length()); |   fdir.Write((const char*)strRelName, strRelName.Length()); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| static bool AddFilesToZip(const wxString& strBase, wxStringList& aFiles, const char* zipfile) | static bool AddFilesToZip(const wxString& strBase, wxArrayString& aFiles, const char* zipfile) | ||||||
| { | { | ||||||
|   const char* zipdir = "zipdir.tmp"; |   const char* zipdir = "zipdir.tmp"; | ||||||
| 
 | 
 | ||||||
| @ -269,13 +242,8 @@ static bool AddFilesToZip(const wxString& strBase, wxStringList& aFiles, const c | |||||||
| 	if (aFiles.GetCount() > 0)  // Dummy test
 | 	if (aFiles.GetCount() > 0)  // Dummy test
 | ||||||
| 	{ | 	{ | ||||||
| 		wxFileOutputStream fdir(zipdir); | 		wxFileOutputStream fdir(zipdir); | ||||||
| 		wxStringListNode* node = aFiles.GetFirst(); |     for (size_t i = 0; i < aFiles.GetCount(); i++)  | ||||||
| 		while (node) | 			AddFileToZip(strBase, aFiles[i], fout, fdir); | ||||||
| 		{ |  | ||||||
| 			const wxString strFile = node->GetData(); |  | ||||||
| 			AddFileToZip(strBase, strFile, fout, fdir); |  | ||||||
| 			node = node->GetNext(); |  | ||||||
| 		} |  | ||||||
| 		nDirSize = fdir.TellO(); | 		nDirSize = fdir.TellO(); | ||||||
| 		nDirStart = fout.TellO(); | 		nDirStart = fout.TellO(); | ||||||
|   } |   } | ||||||
| @ -308,7 +276,7 @@ bool aga_zip(const char* srcfiles, const char* zipfile) | |||||||
| 	strMask += '.'; | 	strMask += '.'; | ||||||
| 	strMask += strExt; | 	strMask += strExt; | ||||||
| 
 | 
 | ||||||
| 	wxStringList aFiles; | 	wxArrayString aFiles; | ||||||
| 	AddFilesToList(strBase, strMask, aFiles); | 	AddFilesToList(strBase, strMask, aFiles); | ||||||
| 
 | 
 | ||||||
| 	return AddFilesToZip(strBase, aFiles, zipfile); | 	return AddFilesToZip(strBase, aFiles, zipfile); | ||||||
| @ -316,7 +284,7 @@ bool aga_zip(const char* srcfiles, const char* zipfile) | |||||||
| 
 | 
 | ||||||
| bool aga_zip_filelist(const char* filelist, const char* zipfile) | bool aga_zip_filelist(const char* filelist, const char* zipfile) | ||||||
| { | { | ||||||
|   wxStringList aFiles; |   wxArrayString aFiles; | ||||||
| 	ifstream fin(filelist); | 	ifstream fin(filelist); | ||||||
| 	while (!fin.eof()) | 	while (!fin.eof()) | ||||||
| 	{ | 	{ | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user