24 using namespace basis;
33 static file_time hidden_comparison_object;
40 _payload.pack(target);
43 _keywords.pack(target);
50 if (!_payload.unpack(source))
return false;
52 if (!_parms.unpack(source))
return false;
53 if (!_keywords.unpack(source))
return false;
54 if (source.
length() < 8)
return false;
64 if (bundle.
read(temp,
sizeof(
int)) !=
sizeof(
int))
return false;
71 FUNCDEF(
"read_an_obscured_int");
73 if (bundle.
read(temp, 2 *
sizeof(
int)) != 2 *
sizeof(
int))
return false;
84 if (bundle.
read(temp, packed_filetime_size()) != packed_filetime_size())
return false;
95 while (!bundle.
eof()) {
97 if (bundle.
read(temp, 1) <= 0)
113 bool worked = read_an_obscured_int(bundle, curr.
_size);
117 curr.
_payload = read_a_string(bundle);
119 worked = read_an_int(bundle, curr.
_flags);
122 curr.
_parms = read_a_string(bundle);
127 worked = read_an_obscured_int(bundle, key_elems);
131 for (
int i = 0; i < (int)key_elems; i++) {
132 astring found = read_a_string(bundle);
133 if (!found)
return false;
136 worked = read_a_filetime(bundle, curr.
c_filetime);
void reset(int number=0, const contents *initial_contents=NULL_POINTER)
Resizes this array and sets the contents from an array of contents.
array subarray(int start, int end) const
Returns the array segment between the indices "start" and "end".
int length() const
Returns the current reported length of the allocated C array.
outcome zap(int start, int end)
Deletes from "this" the objects inclusively between "start" and "end".
Provides a dynamically resizable ASCII character string.
A very common template for a dynamic array of bytes.
Provides file managment services using the standard I/O support.
int read(basis::abyte *buffer, int buffer_size)
reads "buffer_size" bytes from the file into "buffer".
bool eof()
returns true if the cursor is at (or after) the end of the file.
virtual int packed_size() const
#define FUNCDEF(func_in)
FUNCDEF sets the name of a function (and plugs it into the callstack).
The guards collection helps in testing preconditions and reporting errors.
unsigned int un_int
Abbreviated name for unsigned integers.
A platform independent way to obtain the timestamp of a file.
A dynamic container class that holds any kind of object via pointers.
bool obscure_detach(byte_array &packed_form, un_int &to_detach)
shifts the number back and checks validity, false returned if corrupted.
void obscure_attach(byte_array &packed_form, un_int to_attach)
like the normal attach but shifts in some recognizable sentinel data.
void attach(byte_array &packed_form, const byte_array &to_attach)
Packs a byte_array "to_attach" into "packed_form".
bool detach(byte_array &packed_form, byte_array &to_detach)
Unpacks a byte_array "to_detach" from "packed_form".
we will read the manifest pieces out of our own exe image.
basis::un_int _flags
uses the special_bundling_flags.
basis::astring _parms
the parameters to pass on the command line.
static basis::astring read_a_string(filesystem::byte_filer &bundle)
reads a string from the "bundle" file, one byte at a time.
basis::astring _payload
guts of the chunk, such as location for file on target or a variable definition.
void pack(basis::byte_array &target) const
streams out into the "target".
static bool read_an_obscured_int(filesystem::byte_filer &bundle, basis::un_int &found)
reads in our obscured packing format for an int, which takes 8 bytes.
static bool read_manifest(filesystem::byte_filer &bundle, manifest_chunk &to_fill)
reads a chunk out of the "bundle" and stores it in "to_fill".
virtual ~manifest_chunk()
static bool read_a_filetime(filesystem::byte_filer &bundle, basis::byte_array &found)
retrieves packed_filetime_size() byte timestamp from the "bundle".
static bool read_an_int(filesystem::byte_filer &bundle, basis::un_int &found)
reads an integer (4 bytes) from the file into "found".
basis::un_int _size
the size of the packed file.
bool unpack(basis::byte_array &source)
streams in from the "source".
static int packed_filetime_size()
basis::byte_array c_filetime
more than enough room for unix file time.
structures::string_set _keywords
keywords applicable to this item.