public static Variable Create(IVariableContainerSession session, Neo.VM.Types.Map map, string?name) { var container = new NeoMapContainer(session, map); var containerID = session.AddVariableContainer(container); return(new Variable() { Name = name, Type = $"Map[{map.Count}]", VariablesReference = containerID, IndexedVariables = map.Count, }); }
public IEnumerable <Variable> GetVariables() { foreach (var(i, kvp) in map.Select((_kvp, _i) => (_i, _kvp))) { var container = new KvpContainer(session, kvp.Key, kvp.Value); yield return(new Variable() { Name = i.ToString(), VariablesReference = session.AddVariableContainer(container), NamedVariables = 2, }); } }
public IEnumerable <Variable> GetVariables() { foreach (var(key, item) in storage.EnumerateStorage(scriptHash)) { var keyHashCode = key.Span.GetSequenceHashCode(); yield return(new Variable() { Name = keyHashCode.ToString("x"), VariablesReference = session.AddVariableContainer( new KvpContainer(session, keyHashCode, key, item.Value, item.IsConstant)), NamedVariables = 3 }); } }
public static Variable Create(IVariableContainerSession session, ReadOnlyMemory <byte> memory, string?name, bool hashed = false) { var container = new ByteArrayContainer(session, memory); var containerID = session.AddVariableContainer(container); var hash = hashed ? "#" : string.Empty; return(new Variable() { Name = name, Type = $"{hash}ByteArray[{memory.Length}]", Value = container.Span.ToHexString(), VariablesReference = containerID, IndexedVariables = memory.Length, }); }
public static Variable Create(IVariableContainerSession session, Neo.VM.Types.Array array, string name) { var container = new NeoArrayContainer(session, array, name); var containerID = session.AddVariableContainer(container); var typeName = array is Neo.VM.Types.Struct ? "Struct" : "Array"; return(new Variable() { Name = name, Type = $"{typeName}[{array.Count}]", VariablesReference = containerID, IndexedVariables = array.Count, }); }