Home » U++ Library support » U++ Core » something abaut brc file
something abaut brc file [message #8338] |
Sat, 03 March 2007 15:15 |
mubeta
Messages: 77 Registered: October 2006
|
Member |
|
|
Hi,
I think there is some problem in the U++ "brc/ship" tutorial package. Compiling the original file I get error abaut MemReadStream....; in fact this class don't return any String or Stream pointer. Now I am using the String object:
BZ2Decompress(String(root_all[i], root_all_length[i])) ...
(But why there is so many binary container in u++??)
At the same time, using Progress for show a friendly decompression status, the bar restart from zero foe every decompressed file, so I write this code:
// header
class MyProgress : public Progress {
private:
int ts, pp;
public:
void SetMax(int max);
void SetLev(int lev);
bool PartialProgress(int par, int tot);
operator Gate2<int, int>() { return callback(this, &MyProgress::PartialProgress); }
typedef MyProgress CLASSNAME;
};
// cpp
void MyProgress::SetMax(int max) {
ts = max;
return;
}
void MyProgress::SetLev(int lev) {
pp = lev;
Set(pp, ts);
Refresh();
return;
}
bool MyProgress::PartialProgress(int par, int tot) {
double k = (double)ts / (double)tot;
int p = fceil(par / k);
Set(pp+p, ts);
Refresh();
return false;
}
...
// Package part
MyProgress p;
int ts = 0;
int pg = 0;
for(int i = 0; i < root_all_count; i++) ts += root_all_length[i];
p.SetMax(ts);
p.SetLev(0);
p.Title("Installazione in corso");
p.AlignText(Ctrl::LEFT);
RealizePath(installPath + "\\1.5\\");
for(int i = 0; i < root_all_count; i++) {
p.SetText(root_all_files[i]);
if(!SaveFile(installPath + "\\1.5\\" + root_all_files[i], BZ2Decompress(String(root_all[i], root_all_length[i]), p))) {
Exclamation("Errore. Pacchetto di installazione incompleto !");
return;
}
pg += root_all_length[i];
p.SetLev(pg);
}
With many files at the same directory, where one it's much more big the all others, the original progress indicator never show the real decompression status. Using PartialProgress, the percentage bar is much more linear.
Last. brc file is not recompiled if the source file it's changed. How to make it sensitive at the new file??
Mauro Bottizzo.
|
|
|
Goto Forum:
Current Time: Mon Jun 10 02:07:02 CEST 2024
Total time taken to generate the page: 0.01241 seconds
|