Exemple #1
0
    def _do_import(self, fn):
        sf = ps2save.ps2_save_file()
        f = file(fn, "rb")
        try:
            ft = ps2save.detect_file_type(f)
            f.seek(0)
            if ft == "max":
                sf.load_max_drive(f)
            elif ft == "psu":
                sf.load_ems(f)
            elif ft == "psv":
                sf.load_psv(f)
            elif ft == "cbs":
                sf.load_codebreaker(f)
            elif ft == "sps":
                sf.load_sharkport(f)
            elif ft == "npo":
                self.error_box(fn + ": nPort saves" " are not supported.")
                return
            else:
                self.error_box(fn + ": Save file format not" " recognized.")
                return
        finally:
            f.close()

        if not self.mc.import_save_file(sf, True):
            self.error_box(fn + ": Save file already present.")
Exemple #2
0
	def _do_import(self, fn):
		sf = ps2save.ps2_save_file()
		f = file(fn, "rb")
		try:
			ft = ps2save.detect_file_type(f)
			f.seek(0)
			if ft == "max":
				sf.load_max_drive(f)
			elif ft == "psu":
				sf.load_ems(f)
			elif ft == "cbs":
				sf.load_codebreaker(f)
			elif ft == "sps":
				sf.load_sharkport(f)
			elif ft == "npo":
				self.error_box(fn + ": nPort saves"
					       " are not supported.")
				return
			else:
				self.error_box(fn + ": Save file format not"
					       " recognized.")
				return
		finally:
			f.close()

		if not self.mc.import_save_file(sf, True):
			self.error_box(fn + ": Save file already present.")
Exemple #3
0
def do_import(cmd, mc, opts, args, opterr):
	if len(args) < 1:
		opterr("Filename required.")

	args = glob_args(args, glob)
	if opts.directory != None and len(args) > 1:
		opterr("The -d option can only be used with a"
		       "single savefile.")
		
	for filename in args:
		sf = ps2save.ps2_save_file()
		f = file(filename, "rb")
		try:
			ftype = ps2save.detect_file_type(f)
			f.seek(0)
			if ftype == "max":
				sf.load_max_drive(f)
			elif ftype == "psu":
				sf.load_ems(f)
			elif ftype == "psv":
				sf.load_psv(f)
			elif ftype == "cbs":
				sf.load_codebreaker(f)
			elif ftype == "sps":
				sf.load_sharkport(f)
			elif ftype == "npo":
				raise io_error, (EIO, "nPort saves"
						 " are not supported.",
						 filename)
			else:
				raise io_error, (EIO, "Save file format not"
						 " recognized", filename)
		finally:
			f.close()
		dirname = opts.directory
		if dirname == None:
			dirname = sf.get_directory()[8]
		print "Importing", filename, "to", dirname
		if not mc.import_save_file(sf, opts.ignore_existing,
						opts.directory):
			print (filename + ": already in memory card image,"
			       " ignored.")
Exemple #4
0
def do_import(cmd, mc, opts, args, opterr):
    if len(args) < 1:
        opterr("Filename required.")

    args = glob_args(args, glob)
    if opts.directory != None and len(args) > 1:
        opterr("The -d option can only be used with a" "single savefile.")

    for filename in args:
        sf = ps2save.ps2_save_file()
        f = file(filename, "rb")
        try:
            ftype = ps2save.detect_file_type(f)
            f.seek(0)
            if ftype == "max":
                sf.load_max_drive(f)
            elif ftype == "psu":
                sf.load_ems(f)
            elif ftype == "psv":
                sf.load_psv(f)
            elif ftype == "cbs":
                sf.load_codebreaker(f)
            elif ftype == "sps":
                sf.load_sharkport(f)
            elif ftype == "npo":
                raise io_error, (EIO, "nPort saves"
                                 " are not supported.", filename)
            else:
                raise io_error, (EIO, "Save file format not"
                                 " recognized", filename)
        finally:
            f.close()
        dirname = opts.directory
        if dirname == None:
            dirname = sf.get_directory()[8]
        print "Importing", filename, "to", dirname
        if not mc.import_save_file(sf, opts.ignore_existing, opts.directory):
            print(filename + ": already in memory card image," " ignored.")