Example #1
0
        public StringIndex(CacheFile cache)
        {
            if (cache == null)
            {
                throw new ArgumentNullException(nameof(cache));
            }

            this.cache = cache;
            items      = new string[cache.Header.StringCount];
            translator = new StringIdTranslator(Resources.Halo4Strings, cache.Metadata.StringIds);
        }
Example #2
0
        public TagIndex(CacheFile cache)
        {
            if (cache == null)
            {
                throw new ArgumentNullException(nameof(cache));
            }

            this.cache = cache;
            items      = new Dictionary <int, IndexItem>();
            sysItems   = new Dictionary <string, IndexItem>();

            Classes   = new List <TagClass>();
            Filenames = new Dictionary <int, string>();
        }
Example #3
0
        private void TestMap(string folder, string map)
        {
            var cache = new Adjutant.Blam.Halo4.CacheFile(Path.Combine(folder, $"{map}.map"));

            var t0 = Task.Run(() =>
            {
                var gestalt     = cache.TagIndex.FirstOrDefault(t => t.ClassCode == "zone")?.ReadMetadata <cache_file_resource_gestalt>();
                var layoutTable = cache.TagIndex.FirstOrDefault(t => t.ClassCode == "play")?.ReadMetadata <cache_file_resource_layout_table>();

                return(true);
            });

            var t1 = Task.Run(() =>
            {
                var bitmaps = cache.TagIndex.Where(i => i.ClassCode == "bitm")
                              .Select(i => i.ReadMetadata <bitmap>())
                              .ToList();

                return(true);
            });

            var t2 = Task.Run(() =>
            {
                var models = cache.TagIndex.Where(i => i.ClassCode == "mode")
                             .Select(i => i.ReadMetadata <render_model>())
                             .ToList();

                return(true);
            });

            var t3 = Task.Run(() =>
            {
                var bsps = cache.TagIndex.Where(i => i.ClassCode == "sbsp")
                           .Select(i => i.ReadMetadata <scenario_structure_bsp>())
                           .ToList();

                return(true);
            });

            Assert.IsTrue(t0.GetAwaiter().GetResult());
            Assert.IsTrue(t1.GetAwaiter().GetResult());
            Assert.IsTrue(t2.GetAwaiter().GetResult());
            Assert.IsTrue(t3.GetAwaiter().GetResult());
        }
Example #4
0
 public IndexItem(CacheFile cache, int index)
 {
     this.cache = cache;
     Id         = index;
 }