예제 #1
0
    def dotheactionyo(self):

        self.encryptkey = self.entry.get()
        self.keylevel.destroy()
        self.filepath = tkFileDialog.askopenfilename(defaultextension=".map",
                                                     filetypes=[('Escapists map file', '*.map'),
                                                                ('Escapists project file', '*.proj'),
                                                                ('All files', '*.*')],
                                                     initialdir=self.escapistspath())
        if not self.filepath:
            sys.exit()
        elif self.action == 1:
            maptools.decompilemap(self.filepath, self.encryptkey)
        elif self.action == 2:
            maptools.decryptmap(self.filepath, self.encryptkey)
        elif self.action == 3:
            maptools.encryptmap(self.filepath, self.encryptkey)
예제 #2
0
def commandln():
    parser = argparse.ArgumentParser(description='Escapists Map Tools')
    parsegroup = parser.add_mutually_exclusive_group()
    parsegroup.add_argument("-dc", "--decompile", type=str, nargs=2, metavar=('map_file.map', 'encryption_key'),
                            help="Decompiles a map with a given encryption key")
    parsegroup.add_argument("-d", "--decrypt", type=str, nargs=2, metavar=('map_file.map', 'encryption_key'),
                            help="Decrypts a map with a given encryption key")
    parsegroup.add_argument("-e", "--encrypt", type=str, nargs=2, metavar=('map_file.map', 'encryption_key'),
                            help="Encrypts a map with a given encryption key")
    args = parser.parse_args()

    if args.decompile != None:
        maptools.decompilemap(args.decompile[0], args.decompile[1])
    elif args.decrypt != None:
        maptools.decryptmap(args.decrypt[0], args.decrypt[1])
    elif args.encrypt != None:
        maptools.encryptmap(args.encrypt[0], args.encrypt[1])
    else:
        print "No command line arguments, using GUI."
        gui()