add Exit to pisd
git-svn-id: svn://db.shs.com.ru/pip@16 12ceb7fc-bf1f-11e4-8940-5bc7170c53b5
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -78,6 +78,7 @@ public:
|
||||
ret->content << TileList::Row("Show local info", CellFormat());
|
||||
ret->content << TileList::Row("Local file manager", CellFormat());
|
||||
ret->content << TileList::Row("Connect to another daemon", CellFormat());
|
||||
ret->content << TileList::Row("Exit", CellFormat());
|
||||
ret->selection_mode = TileList::NoSelection;
|
||||
return ret;
|
||||
}
|
||||
@@ -108,6 +109,7 @@ public:
|
||||
case 0: tinfo->show(); break;
|
||||
case 1: tfm->show(); break;
|
||||
case 2: tdaemon->show(); break;
|
||||
case 3: PIKbdListener::exiting = true; break;
|
||||
}
|
||||
}
|
||||
return;
|
||||
@@ -151,124 +153,7 @@ void tabInfo() {
|
||||
void tabConnect() {
|
||||
}
|
||||
|
||||
#include <picrc.h>
|
||||
int main(int argc, char * argv[]) {
|
||||
/*PICRC<16> crc(0xFF12FF34);
|
||||
PIByteArray ba(4096);
|
||||
for (int i = 0; i < ba.size_s(); ++i) ba[i] = i % 256;
|
||||
PITimeMeasurer tm;
|
||||
uint_cl<16> ret;
|
||||
for (int i = 0; i < 1000; ++i) {
|
||||
ret = crc.calculate(ba);
|
||||
}*/
|
||||
|
||||
/*if (argc < 2) return 0;
|
||||
PIFile af;
|
||||
if (!af.open(argv[1], PIIODevice::ReadOnly))
|
||||
return 0;
|
||||
piCout << "open" << af.path();
|
||||
PIByteArray sign, jfif, rsign, rdata;
|
||||
int phase = 0, pos = 0, asize = af.size();
|
||||
ushort jct = 0, jcl = 0;
|
||||
uint ct = 0, cl = 0, cc = 0, tend = 1229278788;
|
||||
sign << uchar(0x89) << uchar(0x50) << uchar(0x4E) << uchar(0x47) << uchar(0x0D) << uchar(0x0A) << uchar(0x1A) << uchar(0x0A);
|
||||
jfif << uchar(0x4A) << uchar(0x46) << uchar(0x49) << uchar(0x46);
|
||||
rsign.resize(sign.size());
|
||||
PIByteArray nf;
|
||||
PITimeMeasurer tm;
|
||||
int cnt = 0, j = 0;
|
||||
while (!af.isEnd()) {
|
||||
if (tm.elapsed_m() >= 500) {
|
||||
tm.reset();
|
||||
piCout << "readed" << PIString::readableSize(af.pos());
|
||||
}
|
||||
if (pos >= asize) break;
|
||||
switch (phase) {
|
||||
case 0:
|
||||
af.seek(pos);
|
||||
af.read(rsign.data(), rsign.size_s());
|
||||
if (rsign == sign) {
|
||||
phase = 1;
|
||||
nf = rsign;
|
||||
} else if (rsign.resized(4) == jfif) {
|
||||
phase = 2;
|
||||
af.seek(pos - 6);
|
||||
nf.resize(2);
|
||||
af.read(nf.data(), nf.size_s());
|
||||
} else
|
||||
pos++;
|
||||
break;
|
||||
case 1:
|
||||
af.read(&cl, 4);
|
||||
af.read(&ct, 4);
|
||||
rdata.resize(piLetobe(cl));
|
||||
af.read(rdata.data(), rdata.size_s());
|
||||
af.read(&cc, 4);
|
||||
nf.append(&cl, 4);
|
||||
nf.append(&ct, 4);
|
||||
nf.append(rdata);
|
||||
nf.append(&cc, 4);
|
||||
if (piLetobe(ct) == tend) {
|
||||
piCout << "found PNG size" << PIString::readableSize(nf.size_s());
|
||||
PIFile wf("./PNG/" + PIString(cnt++) + ".png");
|
||||
if (wf.open(PIIODevice::ReadWrite))
|
||||
wf.write(nf.data(), nf.size());
|
||||
nf.clear();
|
||||
phase = 0;
|
||||
pos = af.pos();
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
//jct = 0;
|
||||
//while (jct != ushort(0xD9FF)) {
|
||||
// af.read(&jct, 2);
|
||||
// nf.append(&jct, 2);
|
||||
//}
|
||||
//if (++j >= 30) return 0;
|
||||
af.read(&jct, 2);
|
||||
nf.append(&jct, 2);
|
||||
if (jct == ushort(0xD9FF)) {
|
||||
piCout << "found JPG size" << PIString::readableSize(nf.size_s());
|
||||
PIFile wf("./PNG/" + PIString(cnt++) + ".jpg");
|
||||
if (wf.open(PIIODevice::ReadWrite))
|
||||
wf.write(nf.data(), nf.size());
|
||||
nf.clear();
|
||||
phase = 0;
|
||||
pos = af.pos();
|
||||
break;
|
||||
}
|
||||
af.read(&jcl, 2);
|
||||
nf.append(&jcl, 2);
|
||||
if (jct == 0xDAFF) {
|
||||
jct = 0;
|
||||
int pp = af.pos();
|
||||
rdata.resize(1024*1024*3);
|
||||
af.read(rdata.data(), rdata.size_s());
|
||||
nf.append(rdata);
|
||||
//while (jct != ushort(0xFFD9)) {
|
||||
// af.read(&jct, 2);
|
||||
// nf.append(&jct, 2);
|
||||
// //piCout << Hex << jct;
|
||||
//}
|
||||
piCout << "found JPG size" << PIString::readableSize(nf.size_s());
|
||||
PIFile wf("./PNG/" + PIString(cnt++) + ".jpg");
|
||||
if (wf.open(PIIODevice::ReadWrite))
|
||||
wf.write(nf.data(), nf.size());
|
||||
nf.clear();
|
||||
phase = 0;
|
||||
pos = pp + 1;
|
||||
break;
|
||||
}
|
||||
//piCout << "length" << piLetobe(jcl);
|
||||
rdata.resize(piLetobe(jcl) - 2);
|
||||
af.read(rdata.data(), rdata.size_s());
|
||||
nf.append(rdata);
|
||||
break;
|
||||
};
|
||||
};
|
||||
return 0;*/
|
||||
|
||||
//piCout << Hex << uint(ret) << tm.elapsed_m();
|
||||
piDebug = false;
|
||||
PICLI cli(argc, argv);
|
||||
//cli.addArgument("");
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user