Пример #1
0
        public override IDataFormat CreateDataFormat(IDataModel data, int index)
        {
            var scope = ModelCacheScope.GetCache(data);

            if (previousScope != scope)
            {
                UpdateCache(scope, data);
            }
            return(cache[index - Start]);
        }
Пример #2
0
        public void CanGetOptionsFromStringPointerTable()
        {
            ViewPort.Edit("^aSpot FF @aSpot ^aSpot\"\" Content1\""); // 9 bytes
            ViewPort.Edit("^bSpot FF @bSpot ^bSpot\"\" Content2\""); // 9 bytes
            ViewPort.Edit("^cSpot FF @cSpot ^cSpot\"\" Content3\""); // 9 bytes
            ViewPort.Edit("@20 <aSpot> <bSpot> <cSpot> @20 ");
            ViewPort.Edit("^table[pointer<\"\">]3 ");                // 12 bytes

            using (ModelCacheScope.CreateScope(Model)) {
                var options = ModelCacheScope.GetCache(Model).GetOptions("table");
                Assert.Equal(3, options.Count);
                Assert.Equal("Content1", options[0]);
                Assert.Equal("Content2", options[1]);
                Assert.Equal("Content3", options[2]);
            }
        }
Пример #3
0
 public void EnumFromEnumFromStringUsesIndexValueAsOptions()
 {
     SetupNameTable(0x180);
     viewPort.Edit($"@00 ^enum1[value.]{HardcodeTablesModel.PokemonNameTable}-1 2 3 4 5 6 7 1 ");
     using (ModelCacheScope.CreateScope(model)) {
         var options = ModelCacheScope.GetCache(model).GetOptions("enum1");
         Assert.Equal("Horton", options[1]); // option 0 should be Horton because enum[Horton] = 0
         Assert.Equal("Bob", options[2]);
         Assert.Equal("Carl", options[3]);
         Assert.Equal("Dave", options[4]);
         Assert.Equal("Elen", options[5]);
         Assert.Equal("Fred", options[6]);
         Assert.Equal("Gary", options[7]);
         Assert.Equal(8, options.Count);
     }
 }
        public IEnumerable <string> GetOptions(IDataModel model)
        {
            var cache = ModelCacheScope.GetCache(model);

            return(cache.GetBitOptions(SourceArrayName));
        }
Пример #5
0
        public IReadOnlyList <string> GetOptions(IDataModel model)
        {
            var cache = ModelCacheScope.GetCache(model);

            return(cache.GetBitOptions(SourceArrayName));
        }