Ejemplo n.º 1
0
    def get_active_plugins(self):
        """Get the active list of plugins from the game configuration. Updates self.active and self.order."""
        self.is_sorted = False
        if self.plugin_file == None:
            order_logger.warning(
                "No game configuration file was found!\nAre you sure you're running mlox in or under your game directory?"
            )
            return

        # Get all the plugins
        configFiles = configHandler.configHandler(self.plugin_file,
                                                  self.game_type).read()
        dirFiles = configHandler.dataDirHandler(self.datadir).read()

        # Remove plugins not in the data directory (and correct capitalization)
        configFiles = map(str.lower, configFiles)
        self.order = filter(lambda x: x.lower() in configFiles, dirFiles)

        #Convert the files to lowercase, while storing them in a dict
        self.order = map(self.caseless.cname, self.order)

        order_logger.info("Found {0} plugins in: \"{1}\"".format(
            len(self.order), self.plugin_file))
        for p in self.order:
            self.active[p] = True
        self.origin = "Active Plugins"
Ejemplo n.º 2
0
    def read_from_file(self, fromfile):
        """Get the load order by reading an input file.
        Clears self.game_type and self.datadir.
        Updates self.plugin_file, self.active, and self.order."""
        self.is_sorted = False
        self.game_type = None
        self.datadir = None  #This tells the parser to not worry about things like [SIZE] checks, or trying to read the plugin descriptions
        self.plugin_file = fromfile

        self.order = configHandler.configHandler(fromfile).read()
        if len(self.order) == 0:
            order_logger.warning(
                "No plugins detected.\nmlox understands lists of plugins in the format used by Morrowind.ini or Wrye Mash.\nIs that what you used for input?"
            )

        #Convert the files to lowercase, while storing them in a dict
        self.order = map(self.caseless.cname, self.order)

        order_logger.info("Found {0} plugins in: \"{1}\"".format(
            len(self.order), self.plugin_file))
        for p in self.order:
            self.active[p] = True
        self.origin = "Plugin List from %s" % os.path.basename(fromfile)
        order_logger.info(
            "(Note: When the load order input is from an external source, the [SIZE] predicate cannot check the plugin filesizes, so it defaults to True)."
        )
Ejemplo n.º 3
0
    def write_new_order(self):
        if not isinstance(self.new_order, list) or self.new_order == []:
            order_logger.error("Not saving blank load order.")
            return False
        if isinstance(self.datadir, fileFinder.caseless_dirlist):
            if configHandler.dataDirHandler(self.datadir).write(
                    self.new_order):
                self.is_sorted = True
        if isinstance(self.plugin_file, str):
            if configHandler.configHandler(
                    self.plugin_file, self.game_type).write(self.new_order):
                self.is_sorted = True

        if self.is_sorted != True:
            order_logger.error("Unable to save new load order.")
            return False
        return True
Ejemplo n.º 4
0
update.update_mloxdata()

#File Finder
import modules.fileFinder as fileFinder
file_names = fileFinder.caseless_filenames()
dir_list = fileFinder.caseless_dirlist()
fileFinder.caseless_dirlist(dir_list)       #Make sure copy constructor works
print dir_list.find_file("module_TEST.PY")
print dir_list.find_path("module_TEST.PY")
print dir_list.find_parent_dir("reaDme.mD").dirpath()
print fileFinder.filter_dup_files(dir_list.filelist())
print fileFinder.find_game_dirs()

#Config Handler
import modules.configHandler as configHandler
handleri = configHandler.configHandler("No File")
handler0 = configHandler.configHandler("./userfiles/zinx.txt","Morrowind")
handler1 = configHandler.configHandler("./userfiles/zinx.txt","Invalid")
handler2 = configHandler.configHandler("./userfiles/zinx.txt")
handler3 = configHandler.configHandler("./userfiles/zinx.txt","Oblivion")
print "\x1b[0;30;41m" + "Reading handleri" + '\x1b[0m'
print handleri.read()
print "\x1b[0;30;41m" + "Reading handler0" + '\x1b[0m'
print handler0.read()
print "\x1b[0;30;41m" + "Reading handler1" + '\x1b[0m'
print handler1.read()
print "\x1b[0;30;41m" + "Reading handler2" + '\x1b[0m'
print handler2.read()
print "\x1b[0;30;41m" + "Reading handler3" + '\x1b[0m'
print handler3.read()