Exemplo n.º 1
0
 public byte[] ScriptToByte(ScriptLCS source)
 {
     List<byte> retArr = new List<byte>();
     var code = LCSCore.LCSSerialization(source.Code);
     retArr = retArr.Concat(code).ToList();
     var transactionArg = LCSCore.LCSSerialization(source.TransactionArguments);
     retArr = retArr.Concat(transactionArg).ToList();
     return retArr.ToArray();
 }
Exemplo n.º 2
0
        public ScriptLCS GetScript(byte[] source, ref int cursor)
        {
            var retVal = new ScriptLCS();

            retVal.Code = source.LCSerialization <byte[]>(ref cursor);
            retVal.TransactionArguments =
                source.LCSerialization <List <TransactionArgumentLCS> >(ref cursor);

            return(retVal);
        }
Exemplo n.º 3
0
        public void Script()
        {
            var script = new ScriptLCS();

            script.Code = "move".ToBytes();
            script.TransactionArguments = new List <TransactionArgumentLCS>();
            script.TransactionArguments.Add(new TransactionArgumentLCS
            {
                ArgType = Types.TransactionArgument.Types.ArgType.String,
                String  = "CAFE D00D"
            });
            script.TransactionArguments.Add(new TransactionArgumentLCS
            {
                ArgType = Types.TransactionArgument.Types.ArgType.String,
                String  = "cafe d00d"
            });

            var actual   = LCSCore.LCSDeserialization(script).ByteArrayToString();
            var expected = "040000006d6f76650200000002000000090000004341464520443030440200000009000000636166652064303064".ToLower();

            Assert.Equal(expected, actual);
        }