示例#1
0
void fs_send_file(const gchar *filename)
{
	int err;

	// set pbar title
	if(tifiles_file_is_flash(filename)) 
	{
		create_pbar_(FNCT_SEND_APP, _("Sending app(s)"));
	} 
	else if(tifiles_file_is_group(filename)) 
	{
		create_pbar_(FNCT_SEND_VAR, _("Sending var(s)"));
	} 
	else if(tifiles_file_is_backup(filename)) 
	{
		create_pbar_(FNCT_SEND_BACKUP, _("Restoring"));
	} 
	else if(tifiles_file_is_single(filename)) 
	{
		create_pbar_(FNCT_SEND_VAR, _("Sending var(s)"));
	}
	else if(tifiles_file_is_tigroup(filename))
	{
		create_pbar_type5(_("Restoring"));
	}

	// note that core is currently not bkpt-interruptible when
	// transferring file
	GTK_REFRESH();
	err = ti68k_linkport_send_file(filename);
	handle_error();
	destroy_pbar();	
}
示例#2
0
文件: fs_misc.c 项目: debrouxl/tiemu
gint display_send_files_dbox()
{
	const gchar *ext;
	gchar **filenames, **ptr;
	int err;
	static gchar *folder = NULL;

	// Check for null cable
	if(link_cable.link_type != LINK_NUL)
	{
		tiemu_error(0, "You can't use direct file loading when a cable is set. Change cable to 'null' in the Link Options menu item.");
		return -1;
	}

    // set mask
    switch(tihw.calc_type) 
	{
    case TI92:
        ext = "*.92?";
		break;
	default:
        ext = "*.89?;*.92?;*.9x?;*.9X?;*.v2?;*.V2?";
        break;
    }

	// get filename
	if(folder == NULL)
		folder = g_strdup(inst_paths.base_dir);

	filenames = create_fsels(folder, NULL, (char *)ext);
	if(!filenames)
		return 0;

	// keep folder
	g_free(folder);
	folder = g_path_get_dirname(filenames[0]);

    // check extension
	for(ptr = filenames; *ptr; ptr++)
	{
		if(!tifiles_is_a_ti_file(*ptr) || !tifiles_is_ti9x(tifiles_which_calc_type(*ptr))) 
		{
			msg_box(_("Error"), _("This file is not a valid TI file."));
			g_strfreev(filenames);
			return -1;
		}

		// set pbar title
#if 1
		if(tifiles_is_a_tib_file(*ptr) || tifiles_is_a_flash_file(*ptr)) 
		{
			create_pbar_type5(_("Flash"), "");
		} 
		else if(tifiles_is_a_backup_file(*ptr)) 
		{
			create_pbar_type3(_("Backup"));
		} 
		else if(tifiles_is_a_group_file(*ptr)) 
		{
			create_pbar_type5(_("Sending group file"), "");
		} 
		else if(tifiles_is_a_single_file(*ptr)) 
		{
			create_pbar_type4(_("Sending variable"), "");
		}
#endif

		// note that core is currently not bkpt-interruptible when
		// transferring file
		GTK_REFRESH();
		err = ti68k_linkport_send_file(*ptr);
		handle_error();
		destroy_pbar();	
	}

	g_strfreev(filenames);
	return 0;
}