/// <summary>
        ///     Load every non-mod bundle it can find in ..\\..\\content and ..\\..\\DLC, also calls RebuildRootNode()
        /// </summary>
        /// <param name="exedir">Path to executable directory</param>
        public override void LoadAll(string exedir)
        {
            var di = new DirectoryInfo(exedir);

            if (!di.Exists)
            {
                return;
            }
            var dlc     = Path.Combine(di.Parent.Parent.FullName, "DLC");
            var content = Path.Combine(di.Parent.Parent.FullName, "content");

            var contentdirs = new List <string>(Directory.GetDirectories(content, "content*"));

            contentdirs.Sort(new AlphanumComparator <string>());
            foreach (var file in contentdirs.SelectMany(dir => Directory.GetFiles(dir, "*.cache", SearchOption.AllDirectories).Where(x => Cache.GetCacheTypeOfFile(x) == Cache.Cachetype.Collision)))
            {
                LoadArchive(file);
            }

            var patchdirs = new List <string>(Directory.GetDirectories(content, "patch*"));

            patchdirs.Sort(new AlphanumComparator <string>());
            foreach (var file in patchdirs
                     .SelectMany(dir => Directory.GetFiles(dir, "*.cache", SearchOption.AllDirectories)
                                 .Where(x => Cache.GetCacheTypeOfFile(x) == Cache.Cachetype.Collision)))
            {
                LoadArchive(file);
            }

            if (Directory.Exists(dlc))
            {
                var dlcdirs = new List <string>(Directory.GetDirectories(dlc));
                dlcdirs.Sort(new AlphanumComparator <string>());

                foreach (var file in dlcdirs
                         .Where(_ => VanillaDlClist.Contains(new DirectoryInfo(_).Name))
                         .SelectMany(dir => Directory.GetFiles(dir ?? "", "*.cache", SearchOption.AllDirectories)
                                     .OrderBy(k => k)
                                     .Where(x => Cache.GetCacheTypeOfFile(x) == Cache.Cachetype.Collision)))
                {
                    LoadArchive(file);
                }
            }
            RebuildRootNode();
        }
示例#2
0
        /// <summary>
        /// Loads the .cache files from the /Mods/ folder
        /// Note this resets everything
        /// </summary>
        /// <param name="exedir"></param>
        public void LoadModsBundles(string exedir)
        {
            var mods = Path.Combine(exedir, @"..\..\Mods\");

            if (!Directory.Exists(mods))
            {
                Directory.CreateDirectory(mods);
            }
            var modsdirs = new List <string>(Directory.GetDirectories(mods));

            modsdirs.Sort(new AlphanumComparator <string>());
            var modbundles = modsdirs.SelectMany(dir => Directory.GetFiles(dir, "*.cache", SearchOption.AllDirectories).Where(x => Cache.GetCacheTypeOfFile(x) == Cache.Cachetype.Collision)).ToList();

            foreach (var file in modbundles)
            {
                LoadModBundle(file);
            }

            var dlc = Path.Combine(exedir, @"..\..\DLC\");

            if (Directory.Exists(dlc))
            {
                var dlcdirs = new List <string>(Directory.GetDirectories(dlc));
                dlcdirs.Sort(new AlphanumComparator <string>());
                foreach (var file in dlcdirs.Where(dir => !new Regex("(DLC..)|(DLC.)|(BOB)|(bob)|(EP.)|(ep.)").IsMatch(Path.GetFileName(dir ?? ""))).SelectMany(dir => Directory.GetFiles(dir ?? "", "*.cache", SearchOption.AllDirectories).OrderBy(k => k).Where(x => Cache.GetCacheTypeOfFile(x) == Cache.Cachetype.Collision)))
                {
                    LoadModBundle(file);
                }
            }
            RebuildRootNode();
        }
        /// <summary>
        /// Loads the .cache files from the /Mods/ folder
        /// Note this resets everything
        /// </summary>
        /// <param name="exedir"></param>
        public override void LoadModsArchives(string mods, string dlc)
        {
            if (!Directory.Exists(mods))
            {
                Directory.CreateDirectory(mods);
            }
            var modsdirs = new List <string>(Directory.GetDirectories(mods));

            modsdirs.Sort(new AlphanumComparator <string>());
            var modbundles = modsdirs.SelectMany(dir => Directory.GetFiles(dir, "*.cache", SearchOption.AllDirectories).Where(x => Cache.GetCacheTypeOfFile(x) == Cache.Cachetype.Collision)).ToList();

            foreach (var file in modbundles)
            {
                LoadModArchive(file);
            }

            if (Directory.Exists(dlc))
            {
                var dlcdirs = new List <string>(Directory.GetDirectories(dlc));
                dlcdirs.Sort(new AlphanumComparator <string>());

                var tmp = dlcdirs.Where(_ => !VanillaDlClist.Contains(new DirectoryInfo(_).Name)).ToList();
                foreach (var file in tmp
                         .SelectMany(dir => Directory.GetFiles(dir ?? "", "*.bundle", SearchOption.AllDirectories)
                                     .OrderBy(k => k)
                                     .Where(x => Cache.GetCacheTypeOfFile(x) == Cache.Cachetype.Collision)))
                {
                    LoadModArchive(file);
                }
            }
            RebuildRootNode();
        }
示例#4
0
        /// <summary>
        ///     Load every non-mod bundle it can find in ..\..\content and ..\..\DLC, also calls RebuildRootNode()
        /// </summary>
        /// <param name="exedir">Path to executable directory</param>
        public void LoadAll(string exedir)
        {
            var content = Path.Combine(exedir, @"..\..\content\");

            var contentdirs = new List <string>(Directory.GetDirectories(content, "content*"));

            contentdirs.Sort(new AlphanumComparator <string>());
            foreach (var file in contentdirs.SelectMany(dir => Directory.GetFiles(dir, "*.cache", SearchOption.AllDirectories).Where(x => Cache.GetCacheTypeOfFile(x) == Cache.Cachetype.Collision)))
            {
                LoadBundle(file);
            }

            var patchdirs = new List <string>(Directory.GetDirectories(content, "patch*"));

            patchdirs.Sort(new AlphanumComparator <string>());
            foreach (var file in patchdirs.SelectMany(dir => Directory.GetFiles(dir, "*.cache", SearchOption.AllDirectories).Where(x => Cache.GetCacheTypeOfFile(x) == Cache.Cachetype.Collision)))
            {
                LoadBundle(file);
            }

            var dlc = Path.Combine(exedir, @"..\..\DLC\");

            if (Directory.Exists(dlc))
            {
                var dlcdirs = new List <string>(Directory.GetDirectories(dlc));
                dlcdirs.Sort(new AlphanumComparator <string>());
                foreach (var file in dlcdirs.Where(dir => new Regex("(DLC..)|(DLC.)|(BOB)|(ep.)|(bob)|(EP.)").IsMatch(Path.GetFileName(dir ?? ""))).SelectMany(dir => Directory.GetFiles(dir ?? "", "*.cache", SearchOption.AllDirectories).OrderBy(k => k).Where(x => Cache.GetCacheTypeOfFile(x) == Cache.Cachetype.Collision)))
                {
                    LoadBundle(file);
                }
            }
            RebuildRootNode();
        }