Exemple #1
0
int Cst_file::extract_as_text(const string& name) const
{
	ofstream f(name.c_str());
	for (int i = 0; i < get_c_strings(); i++)
		f << get_string(i) << endl;
	return f.fail();
}
Exemple #2
0
void Ccsf_file::write(byte* d) const
{
	byte* w = d;
	t_csf_header& header = *reinterpret_cast<t_csf_header*>(w);
	w += sizeof(t_csf_header);
	header.id = csf_file_id;
	header.flags1 = 3;
	header.count1 = get_c_strings();
	header.count2 = get_c_strings();
	header.zero = 0;
	header.flags2 = 0;
	for (auto& i : m_map)
	{
		write_int(w, csf_label_id);
		write_int(w, 1);
		write_string(w, i.first);
		write_int(w, i.second.extra_value.empty() ? csf_string_id : csf_string_w_id);
		write_wstring(w, i.second.value);
		if (!i.second.extra_value.empty())
			write_string(w, i.second.extra_value);
	}
	assert(w - d == get_write_size());
}