コード例 #1
0
        private void TestMap(string map)
        {
            var cache = new Adjutant.Blam.Halo1.CacheFile(Path.Combine(MapsFolder, $"{map}.map"));

            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 == "mod2")
                             .Select(i => i.ReadMetadata <gbxmodel>())
                             .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(t1.GetAwaiter().GetResult());
            Assert.IsTrue(t2.GetAwaiter().GetResult());
            Assert.IsTrue(t3.GetAwaiter().GetResult());
        }
コード例 #2
0
        public BitmapsAddressTranslator(CacheFile cache, IndexItem tag, EndianReader reader)
        {
            reader.Seek(8, SeekOrigin.Begin);
            var indexAddress = reader.ReadInt32();
            var tagIndex     = tag.MetaPointer.Value;

            reader.Seek(indexAddress + tagIndex * 12 + 8, SeekOrigin.Begin);
            TagAddress = reader.ReadInt32();
        }
コード例 #3
0
        public BSPAddressTranslator(CacheFile cache, int id)
        {
            var bspData = cache.TagIndex.GetGlobalTag("scnr").ReadMetadata <scenario>().StructureBSPs.SingleOrDefault(i => (i.BSPReference.TagId) == id);

            if (bspData == null)
            {
                throw new InvalidOperationException();
            }

            data = bspData;
        }
コード例 #4
0
        public TagIndex(CacheFile cache)
        {
            if (cache == null)
            {
                throw new ArgumentNullException(nameof(cache));
            }

            this.cache = cache;
            items      = new List <IndexItem>();
            sysItems   = new Dictionary <string, IndexItem>();
            Filenames  = new Dictionary <int, string>();
        }
コード例 #5
0
 public BitmapsAddressTranslator(CacheFile cache, IndexItem tag)
     : this(cache, tag, cache.CreateBitmapsReader())
 {
 }
コード例 #6
0
 public IndexItem(CacheFile cache)
 {
     this.cache = cache;
 }
コード例 #7
0
 public TagAddressTranslator(CacheFile cache)
 {
     this.cache = cache;
 }