Esempio n. 1
0
        public ABI(string fileName)
        {
            var json = File.ReadAllText(fileName);
            var root = JSONReader.ReadFromString(json);

            var fn = root.GetNode("functions");

            foreach (var child in fn.Children)
            {
                var f = new AVMFunction();
                f.name       = child.GetString("name");
                f.returnType = child.GetString("returnType");

                var p = child.GetNode("parameters");
                if (p != null && p.ChildCount > 0)
                {
                    f.inputs = new AVMInput[p.ChildCount];
                    for (int i = 0; i < f.inputs.Length; i++)
                    {
                        var input = new AVMInput();
                        input.name  = p[i].GetString("name");
                        input.type  = p[i].GetString("type");
                        f.inputs[i] = input;
                    }
                }
                else
                {
                    f.inputs = null;
                }

                functions[f.name] = f;
            }

            entryPoint = functions[root.GetString("entrypoint")];
        }
Esempio n. 2
0
        public ABI()
        {
            var f = new AVMFunction();

            f.name   = "Main";
            f.inputs = new AVMInput[] { new AVMInput()
                                        {
                                            name = "args", type = "Array"
                                        } };

            this.functions[f.name] = f;
            this.entryPoint        = functions.Values.FirstOrDefault();
        }