Subversion Repositories spk

Rev

Rev 96 | Rev 116 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 96 Rev 115
Line 25... Line 25...
25
 
25
 
26
// LZMA compression
26
// LZMA compression
27
#include "lzma/Lzma86Enc.h"
27
#include "lzma/Lzma86Enc.h"
28
#include "lzma/Lzma86Dec.h"
28
#include "lzma/Lzma86Dec.h"
29
 
29
 
-
 
30
// X2BOD
-
 
31
/*
-
 
32
#include "x2bc/x2bc_common/settings.h"
-
 
33
#include "x2bc/x2bc_common/bob_dom.h"
-
 
34
#include "x2bc/x2bc_common/bod_parser.h"
-
 
35
#include "x2bc/x2bc_common/realfile_stream.h"
-
 
36
*/
-
 
37
#include "../Windows/libx2bc.h"
-
 
38
 
30
//////////////////////////////////////////////////////////////////////
39
//////////////////////////////////////////////////////////////////////
31
// Construction/Destruction
40
// Construction/Destruction
32
//////////////////////////////////////////////////////////////////////
41
//////////////////////////////////////////////////////////////////////
33
 
42
 
34
void CProgressInfoDone::DoingFile ( C_File *file )
43
void CProgressInfoDone::DoingFile ( C_File *file )
Line 1736... Line 1745...
1736
		return true;
1745
		return true;
1737
 
1746
 
1738
	return false;
1747
	return false;
1739
}
1748
}
1740
 
1749
 
-
 
1750
unsigned char *C_File::BobDecompile(size_t *size)
-
 
1751
{
-
 
1752
	(*size) = 0;
-
 
1753
 
-
 
1754
	Utils::String fromFile = this->GetFilePointer().ToString();
-
 
1755
	if ( !CFileIO::Exists(fromFile) ) {
-
 
1756
		if ( this->WriteToFile(CPackages::tempDirectory() + "bob.tmp") ) {
-
 
1757
			fromFile = CPackages::tempDirectory() + "bob.tmp";
-
 
1758
		}
-
 
1759
	}
-
 
1760
 
-
 
1761
	fromFile = fromFile.findReplace("/", "\\");
-
 
1762
	Utils::String toFile = CPackages::tempDirectory() + "bod.tmp";
-
 
1763
	toFile = toFile.findReplace("/", "\\");
-
 
1764
 
-
 
1765
	if ( CFileIO::Exists(fromFile) ) {
-
 
1766
		if ( X2BC_BOB2BOD(fromFile.c_str(), toFile.c_str()) ) {
-
 
1767
			CFileIO F(toFile);
-
 
1768
			if ( F.exists() && F.startRead() ) {
-
 
1769
				unsigned char *data = F.readAll(size);
-
 
1770
				F.close();
-
 
1771
				F.remove();
-
 
1772
 
-
 
1773
				return data;
-
 
1774
			}
-
 
1775
		}
-
 
1776
	}
-
 
1777
 
-
 
1778
	if ( CFileIO::Exists(CPackages::tempDirectory() + "bob.tmp") )
-
 
1779
		CFileIO(CPackages::tempDirectory() + "bob.tmp").remove();
-
 
1780
	/*
-
 
1781
	Settings settings;
-
 
1782
	bob_dom_document doc(&settings);
-
 
1783
	
-
 
1784
	ibinaryrealfile is;
-
 
1785
	otextrealfile os;
-
 
1786
	os.open(CPackages::tempDirectory() + "tmp.tmp", filestream::create);
-
 
1787
	is.open(this->GetFilePointer().c_str(), filestream::rdonly);
-
 
1788
	
-
 
1789
	if(is.fail() || os.fail()) return NULL;
-
 
1790
	
-
 
1791
	bool bRes=doc.convert(is, os);
-
 
1792
 
-
 
1793
	for(bob_dom_document::ErrorIterator &it=doc.errors.begin(); it!=doc.errors.end(); ++it){
-
 
1794
		//BOBError(*it);
-
 
1795
	}
-
 
1796
 
-
 
1797
	if ( bRed ) {
-
 
1798
		CFileIO F(CPackages::tempDirectory() + "tmp.tmp");
-
 
1799
		if ( F.exists() && F.startRead() ) {
-
 
1800
			unsigned char *data = F.readAll(size);
-
 
1801
			F.close();
-
 
1802
			F.remove();
-
 
1803
 
-
 
1804
			return data;
-
 
1805
		}
-
 
1806
	}
-
 
1807
*/
-
 
1808
	return NULL;
-
 
1809
}
-
 
1810
 
1741
bool C_File::BobDecompile()
1811
bool C_File::BobDecompile()
1742
{
1812
{
1743
	bool bRes=false;
1813
	bool bRes=false;
1744
 
1814
 
1745
 
1815