示例#1
0
def factory(name):
	if name.endswith('.xci'):
		f = Xci()
	elif name.endswith('.nsp'):
		f = Nsp()
	elif name.endswith('.nsx'):
		f = Nsp()
	elif name.endswith('.nca'):
		f =  Nca()
	elif name.endswith('.tik'):
		f =  Ticket()
	else:
		f = File()

	return f
示例#2
0
def factory(name):
	if name.endswith('.xci'):
		f = Xci()
	elif name.endswith('.nsp') or name.endswith('.nsz'):
		f = Nsp()
	elif name.endswith('.nsx'):
		f = Nsp()
	elif name.endswith('.nca') or name.endswith('.ncz'):
		f =  Nca()
	elif name.endswith('.nacp'):
		f =  Nacp()
	elif name.endswith('.tik'):
		f =  Ticket()
	elif name.endswith('.cnmt'):
		f =  Cnmt()
	else:
		f = File()

	return f
示例#3
0
def factory(name, file=None, mode='rb'):
    ext = name.split('.')[-1]
    if ext == 'xci' or ext == 'xcz':
        f = Xci(file, mode)
    elif ext == 'nsp' or ext == 'nsz' or ext == 'nsx':
        f = Nsp(file, mode)
    elif ext == 'nca' or ext == 'ncz':
        f = Nca(file, mode)
    elif ext == 'nacp':
        f = Nacp(file, mode)
    elif ext == 'tik':
        f = Ticket(file, mode)
    elif ext == 'cnmt':
        f = Cnmt(file, mode)
    else:
        f = File(file, mode)

    return f
示例#4
0
文件: nut.py 项目: blawar/nut
                for filePath in args.file:
                    try:
                        nut.compress(filePath,
                                     21 if args.level is None else args.level,
                                     args.output)

                    except BaseException as e:
                        Print.error(str(e))
                        raise

            if args.decompress:
                for f in expandFiles(args.file):
                    path = nut.NszDecompressor.decompress(
                        str(f), Config.paths.nspOut)
                    if path:
                        i = Nsp(path)
                        i.move()

            if args.update_titles:
                nut.initTitles()
                for url in Config.titleUrls:
                    nut.updateDb(url)
                Titles.loadTxtDatabases()
                Titles.save()

            if args.update_check:
                nut.initTitles()
                nut.initFiles()
                for _, game in Nsps.files.items():
                    title = game.title()
                    if title.isUpdate or title.isDLC: