示例#1
0
 static JToken StackItemToJson(StackItem item, string?typeHint)
 {
     return(typeHint switch
     {
         "Boolean" => item.GetBoolean().ToString(),
         "Integer" => item.GetBigInteger().ToString(),
         "String" => item.GetString(),
         _ => item switch
         {
             Neo.VM.Types.Boolean _ => item.GetBoolean().ToString(),
             Neo.VM.Types.ByteArray _ => $"{item.GetBigInteger().ToHexString()} ({item.GetString()})",
             Neo.VM.Types.Integer _ => item.GetBigInteger().ToString(),
             Neo.VM.Types.Array array => new JArray(array.Select(i => StackItemToJson(i, null))),
             _ => throw new NotSupportedException(item.GetType().Name),
         }
     });
示例#2
0
 public ByteArrayStackItem(byte[] value) : base(value)
 {
     _item = new Neo.VM.Types.ByteArray(value);
 }
示例#3
0
 public ByteArrayStackItem(Neo.VM.Types.ByteArray item) : base(item.GetByteArray())
 {
     _item = item;
 }