Ejemplo n.º 1
0
clk_command_handler create_send_xml_handler(const std::wstring&                     command_name,
                                            bool                                    expect_clock,
                                            bool                                    expect_time,
                                            const spl::shared_ptr<command_context>& context)
{
    return [=](const std::vector<std::wstring>& params) {
        context->send_to_flash(get_xml(command_name, expect_clock, expect_time, params));
    };
}
Ejemplo n.º 2
0
int LocalPackage::injectFile()
{
	if (!dialogMode && verbose) say(string(_("Injecting file") + filename + "\n").c_str());

	internal=true;
	// Injecting data from file!
	// If any of functions fails (e.g. return!=0) - break process and return failure code (!=0);
	//int ret=0;
	//mDebug("local_package.cpp: injectFile(): start");
	//mDebug("get_xml");
	if (get_xml()!=0)
	{
		//mDebug("local_package.cpp: injectFile(): get_xml FAILED");
		return -3;
	}
	if (getExtension(filename)=="spkg") {
		//printf("Source package detected, adding to XML\n");
		xmlNewTextChild(_packageXMLNode, NULL, (const xmlChar *)"type", (const xmlChar *)"source");
		data.set_type(PKGTYPE_SOURCE);
	}
	if (getExtension(filename)=="tgz" || getExtension(filename) == "txz" || getExtension(filename) == "tlz" ||getExtension(filename) == "tbz" ) {
		xmlNewTextChild(_packageXMLNode, NULL, (const xmlChar *)"type", (const xmlChar *)"binary");
		data.set_type(PKGTYPE_BINARY);
	}

	


	//mDebug("get_size()\n");
	if (get_size()!=0)
	{
		mDebug("local_package.cpp: injectFile(): get_size() FAILED");
		return -1;
	}
	//mDebug("create_md5\n");
	if (create_md5()!=0)
	{
		mDebug("local_package.cpp: injectFile(): create_md5 FAILED");
		return -2;
	}
	//mDebug("set_additional_data\n");
	//mDebug("local_packaige.cpp: injectFile(): filename is "+ filename);
	data.set_filename(filename);
	
	if (set_additional_data()!=0)
	{
		mDebug("local_package.cpp: injectFile(): set_additional_data FAILED");
		return -6;
	}
	delete_tmp_files();	
	//mDebug("local_package.cpp: injectFile(): end");
	return 0;
}