1 /***************************************************************************
2 * Copyright (C) 2006 Kent Gustavsson <nedo80@gmail.com>
3 ****************************************************************************/
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Library General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 // Created by: Kent Gustavsson <nedo80@gmail.com>
25 // Created on: Tue Feb 28 16:05:38 2006
31 RARBlock::RARBlock(std::istream
&in
)
33 checksum
= in
.get() * 256;
39 flags
+= in
.get()* 256;
42 headsize
+= in
.get() * 256;
44 if ( ( flags
& 0x8000 ) != 0 )
47 size
+= in
.get() * 256;
48 size
+= in
.get() * 256 * 256;
49 size
+= in
.get() * 256 * 256 * 256;
50 in
.seekg(headsize
- 7 - 4 + size
, std::ios::cur
);
55 in
.seekg(headsize
- 7, std::ios::cur
);
74 std::cout
<< "Checksum: 0x" << (std::hex
) << checksum
<< std::endl
;
75 std::cout
<< "BlockType: 0x" << (std::hex
) << (int)blocktype
;
80 std::cout
<< " Marker Block" << std::endl
;
83 std::cout
<< " Archive Header" << std::endl
;
86 std::cout
<< " File Header" << std::endl
;
89 std::cout
<< " Comment Header" << std::endl
;
92 std::cout
<< " Extra Information" << std::endl
;
95 std::cout
<< " Sub Block" << std::endl
;
98 std::cout
<< " Recovery Record" << std::endl
;
101 std::cout
<< " Unknown Block" << std::endl
;
105 std::cout
<< "Flags: 0x" << (std::hex
) << flags
<< std::endl
;
106 if( blocktype
== FILE )
108 std::cout
<< "\tData in previous file " << (int)(flags
& 0x01) << std::endl
;
109 std::cout
<< "\tData in continues file " << (int)(flags
& 0x02) << std::endl
;
110 std::cout
<< "\tPassword " << (int)(flags
& 0x04) << std::endl
;
111 std::cout
<< "\tFile Comment " << (int)(flags
& 0x08) << std::endl
;
112 std::cout
<< "\tSolid flag " << (int)(flags
&0x10) << std::endl
;
113 std::cout
<< "\tDictionary: ";
115 switch ((int)(flags
&0xe0) >> 5)
118 std::cout
<< "64 Kb" << std::endl
;
121 std::cout
<< "128 Kb" << std::endl
;
124 std::cout
<< "256 Kb" << std::endl
;
127 std::cout
<< "512 Kb" << std::endl
;
130 std::cout
<< "1024 Kb" << std::endl
;
133 std::cout
<< "reserved_1" << std::endl
;
136 std::cout
<< "reserved_2" << std::endl
;
139 std::cout
<< "directory" << std::endl
;
144 std::cout
<< "Size: 0x" << headsize
<< std::endl
;
145 std::cout
<< "DataSize: 0x" << size
<< std::endl
;