Ejemplo n.º 1
0
 static Variable ToVariable(IVariableManager manager, ByteArrayContainer container, string name, string type)
 {
     return(new Variable()
     {
         Name = name,
         Value = $"{type}[{container.memory.Length}]",
         VariablesReference = manager.Add(container),
         IndexedVariables = container.memory.Length,
     });
 }
Ejemplo n.º 2
0
        public static Variable Create(IVariableManager manager, NeoMap map, string name)
        {
            var container = new NeoMapContainer(map);

            return(new Variable()
            {
                Name = name,
                Value = $"Map[{map.Count}]",
                VariablesReference = manager.Add(container),
                NamedVariables = map.Count
            });
        }
Ejemplo n.º 3
0
        public static Variable Create(IVariableManager manager, NeoArray array, string name)
        {
            var typeName  = array is NeoStruct ? "Struct" : "Array";
            var container = new NeoArrayContainer(array);

            return(new Variable()
            {
                Name = name,
                Value = $"{typeName}[{array.Count}]",
                VariablesReference = manager.Add(container),
                IndexedVariables = array.Count,
            });
        }
        public IEnumerable <Variable> Enumerate(IVariableManager manager)
        {
            var storages = GetStorages();

            foreach (var(key, item) in storages)
            {
                var keyHashCode = key.Span.GetSequenceHashCode().ToString("x8");
                var kvp         = new KvpContainer(key, item, keyHashCode);
                yield return(new Variable()
                {
                    Name = keyHashCode,
                    Value = string.Empty,
                    VariablesReference = manager.Add(kvp),
                    NamedVariables = 2
                });
            }
        }