Beispiel #1
0
 public MethodDescriptor(string name, List <Arguement> arguements,
                         Arguement returns)
 {
     Name       = name;
     Arguements = arguements;
     Returns    = returns;
 }
Beispiel #2
0
        public void Bind()
        {
            //TEST
            var m = new List <MethodDescriptor>()
            {
                new MethodDescriptor(
                    "add",
                    new List <Arguement>()
                {
                    Arguement.Create("int"),
                    Arguement.Create("int")
                },
                    Arguement.Create("int")
                    ),
                new MethodDescriptor(
                    "subtract",
                    new List <Arguement>()
                {
                    Arguement.Create("int"),
                    Arguement.Create("int")
                },
                    Arguement.Create("int")
                    )
            };

            _methodDescriptions.Add(_bindMap.Keys.First(), m);

            foreach (var iClass in _bindMap)
            {
                var proxyBuilder = new ProxyBuilder()
                                   .AddNodeJsExe(NODE_EXE)
                                   .AddNodeJsEntry(iClass.Value);

                if (_methodDescriptions.TryGetValue(iClass.Key, out var methods))
                {
                    proxyBuilder.AddMethods(methods);
                }
                else
                {
                    throw new Exception($"Could not find a valid method descriptor for type of {iClass.Key}");
                }
                _container.Add(iClass.Key, proxyBuilder.Build(iClass.Key));
            }
        }