示例#1
0
        public override void CreateCode(Node node, CodeExtension codeExtension)
        {
            DataSourceNodeClass nodeClass = node.Class as DataSourceNodeClass;

            codeExtension.AddSensor(node as DataSource);
            codeExtension.AddExtras(nodeClass.NeededExtras);

            codeExtension.AddImport(nodeClass.OutputType.Name);
            codeExtension.AddImport(nodeClass.MainClass);


            //Add the proxy methods to the Imports:
            nodeClass.ProxyProperties
            .Select(p => p.PropertyType.Name)
            .ForEach(codeExtension.AddImport);


            //We have a special case: Only a DataSource:
            if (codeExtension.RootNode == node)
            {
                string code = " private void transform0(){\n"
                              + "     data = sensor0." + nodeClass.DataMethod + "();\n"
                              + " }\n";

                codeExtension.AddCodeStep(code);
            }
        }