Exemplo n.º 1
0
        // Moves folder to target.
        // If an identically named subfolder of target already exists, merges instead.
        // Root is not movable.
        public static bool Move(this ModFolder folder, ModFolder target)
        {
            if (MoveNoSave(folder, target))
            {
                SaveModChildren(target);
                return(true);
            }

            return(false);
        }
Exemplo n.º 2
0
        // Move a single mod to the target folder.
        // Returns true and saves if anything changed.
        public static bool Move(this ModData mod, ModFolder target)
        {
            if (MoveNoSave(mod, target))
            {
                SaveMod(mod);
                return(true);
            }

            return(false);
        }
Exemplo n.º 3
0
        // Rename the target folder, merging it and its subfolders if the new name already exists.
        // Saves all mods manipulated thus, and returns true if anything changed.
        public static bool Rename(this ModFolder target, string newName)
        {
            if (RenameNoSave(target, newName))
            {
                SaveModChildren(target);
                return(true);
            }

            return(false);
        }
Exemplo n.º 4
0
        // Merge source with target, moving all direct mod children of source to target,
        // and moving all subfolders of source to target, or merging them with targets subfolders if they exist.
        // Returns true and saves if anything changed.
        public static bool Merge(this ModFolder source, ModFolder target)
        {
            if (MergeNoSave(source, target))
            {
                SaveModChildren(target);
                return(true);
            }

            return(false);
        }
Exemplo n.º 5
0
        // Find a specific mod folder by its path from Root.
        // Returns true if the folder was found, and false if not.
        // The out parameter will contain the furthest existing folder.
        public static bool Find(string path, out ModFolder folder)
        {
            var split = path.Split(new[] { '/' }, StringSplitOptions.RemoveEmptyEntries);

            folder = Root;
            foreach (var part in split)
            {
                if (!folder.FindSubFolder(part, out folder))
                {
                    return(false);
                }
            }

            return(true);
        }