Example #1
0
        private void TestMap(string folder, string map)
        {
            var cache = new Adjutant.Blam.HaloReach.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>();
                var soundGestalt = cache.TagIndex.FirstOrDefault(t => t.ClassCode == "ugh!")?.ReadMetadata <sound_cache_file_gestalt>();

                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);
            });

            var t4 = Task.Run(() =>
            {
                var bsps = cache.TagIndex.Where(i => i.ClassCode == "snd!")
                           .Select(i => i.ReadMetadata <sound>())
                           .ToList();

                return(true);
            });

            Assert.IsTrue(t0.GetAwaiter().GetResult());
            Assert.IsTrue(t1.GetAwaiter().GetResult());
            Assert.IsTrue(t2.GetAwaiter().GetResult());
            Assert.IsTrue(t3.GetAwaiter().GetResult());
            Assert.IsTrue(t4.GetAwaiter().GetResult());
        }
Example #2
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.HaloReachStrings, cache.Metadata.StringIds);
        }
Example #3
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 #4
0
 public IndexItem(CacheFile cache, int index)
 {
     this.cache = cache;
     Id         = index;
 }