public static DiagramBlock CreateDiagramBlock(BlockBase block, bool useNextPosition)
        {
            var className = block.GetAssemblyClassName();
            var imageName = "img" + className + "Mini";
            var image     = GetResourceImage(imageName, 30, 20);
            var label     = GetResourceString(block.Name);
            var shortname = typeof(BlockOutputNode).GetProperty("ShortName");

            return(new DiagramBlock(image, label, block, block.InputNodes.ToArray <object>(), block.OutputNodes.ToArray <object>(), shortname, true, useNextPosition));
        }
Beispiel #2
0
        public static DiagramBlock CreateDiagramBlock(BlockBase block, bool useNextPosition)
        {
            var   className = (block.ID == null) ?  block.GetAssemblyClassName() : block.ID;
            Image image     = Envision.Properties.Resources.unknownicon;

            if (block.Picture != null)
            {
                image = block.Picture;
            }
            var label     = className;
            var shortname = typeof(BlockOutputNode).GetProperty("ShortName");

            return(new DiagramBlock(image, label, block, block.InputNodes.ToArray <object>(), block.OutputNodes.ToArray <object>(), shortname, true, useNextPosition));
        }
Beispiel #3
0
        private string GetVariableName(BlockBase block)
        {
            var baseVariableName = block.GetAssemblyClassName();

            if (!baseVariableName.ToLower().Contains("block"))
            {
                baseVariableName += "Block";
            }
            baseVariableName = char.ToLower(baseVariableName[0]) + baseVariableName.Substring(1);
            if (_generatedBlocks.All(it => it.VariableName != baseVariableName))
            {
                return(baseVariableName);
            }
            var variableName = baseVariableName;
            var i            = 1;

            while (_generatedBlocks.Any(it => it.VariableName == variableName))
            {
                i++;
                variableName = baseVariableName + i;
            }
            return(variableName);
        }