示例#1
0
        public ZeroTouchSearchElement(FunctionDescriptor functionDescriptor)
        {
            this.functionDescriptor = functionDescriptor;

            var displayName = functionDescriptor.UserFriendlyName;

            if (functionDescriptor.IsOverloaded)
            {
                displayName += "(" + string.Join(", ", functionDescriptor.Parameters) + ")";
            }

            Name             = displayName;
            FullCategoryName = functionDescriptor.Category;
            Description      = functionDescriptor.Description;
            Assembly         = functionDescriptor.Assembly;

            inputParameters  = new List <Tuple <string, string> >(functionDescriptor.InputParameters);
            outputParameters = new List <string>()
            {
                functionDescriptor.ReturnType
            };

            foreach (var tag in functionDescriptor.GetSearchTags())
            {
                SearchKeywords.Add(tag);
            }

            iconName = GetIconName();
        }
 protected NodeModelSearchElementBase(TypeLoadData typeLoadData)
 {
     Name = typeLoadData.Name;
     foreach (var aka in typeLoadData.AlsoKnownAs.Concat(typeLoadData.SearchKeys))
     {
         SearchKeywords.Add(aka);
     }
     FullCategoryName = typeLoadData.Category;
     Description      = typeLoadData.Description;
 }
示例#3
0
 protected NodeModelSearchElementBase(TypeLoadData typeLoadData)
 {
     Name = typeLoadData.Name;
     foreach (var aka in typeLoadData.AlsoKnownAs.Concat(typeLoadData.SearchKeys))
     {
         SearchKeywords.Add(aka);
     }
     FullCategoryName = typeLoadData.Category;
     Description      = typeLoadData.Description;
     Assembly         = typeLoadData.Assembly.Location;
     inputParameters  = new List <System.Tuple <string, string> >();
     outputParameters = new List <string>();
     iconName         = typeLoadData.Type.FullName;
 }
        public TestNodeSearchElement(string category, string name, ElementTypes type, string path)
        {
            Name             = name;
            FullCategoryName = category;
            ElementType      = type;
            var keys = category.Split('.');

            foreach (var item in keys)
            {
                SearchKeywords.Add(item);
            }
            iconName = name;
            Assembly = path;
        }
示例#5
0
        public ZeroTouchSearchElement(FunctionDescriptor functionDescriptor)
        {
            this.functionDescriptor = functionDescriptor;

            var displayName = functionDescriptor.UserFriendlyName;

            if (functionDescriptor.IsOverloaded)
            {
                displayName += "(" + string.Join(", ", functionDescriptor.Parameters) + ")";
            }

            Name             = displayName;
            FullCategoryName = functionDescriptor.Category;
            Description      = functionDescriptor.Description;
            foreach (var tag in functionDescriptor.GetSearchTags())
            {
                SearchKeywords.Add(tag);
            }
        }
示例#6
0
        public ZeroTouchSearchElement(FunctionDescriptor functionDescriptor)
        {
            this.functionDescriptor = functionDescriptor;

            var displayName = functionDescriptor.UserFriendlyName;

            if (functionDescriptor.IsOverloaded)
            {
                displayName += "(" + string.Join(", ", functionDescriptor.Parameters) + ")";
            }

            Name             = displayName;
            UserFriendlyName = functionDescriptor.UserFriendlyName;
            FullCategoryName = functionDescriptor.Category;
            Description      = functionDescriptor.Description;
            Assembly         = functionDescriptor.Assembly;

            ElementType = ElementTypes.ZeroTouch;

            if (functionDescriptor.IsBuiltIn)
            {
                ElementType |= ElementTypes.BuiltIn;
            }
            // Assembly, that is located in package directory, considered as part of package.
            if (Assembly.StartsWith(functionDescriptor.PathManager.PackagesDirectory))
            {
                ElementType |= ElementTypes.Packaged;
            }

            inputParameters  = new List <Tuple <string, string> >(functionDescriptor.InputParameters);
            outputParameters = new List <string>()
            {
                functionDescriptor.ReturnType
            };

            foreach (var tag in functionDescriptor.GetSearchTags())
            {
                SearchKeywords.Add(tag);
            }

            iconName = GetIconName();
        }
 protected NodeModelSearchElementBase(TypeLoadData typeLoadData)
 {
     Name = typeLoadData.Name;
     foreach (var aka in typeLoadData.AlsoKnownAs.Concat(typeLoadData.SearchKeys))
     {
         SearchKeywords.Add(aka);
         // By default search tag has weight = 0.5
         keywordWeights.Add(0.5);
     }
     FullCategoryName = typeLoadData.Category;
     Description      = typeLoadData.Description;
     Assembly         = typeLoadData.Assembly.Location;
     inputParameters  = new List <System.Tuple <string, string> >();
     outputParameters = new List <string>();
     iconName         = typeLoadData.Type.FullName;
     ElementType      = ElementTypes.ZeroTouch;
     if (typeLoadData.IsPackageMember)
     {
         ElementType |= ElementTypes.Packaged;
     }
 }
示例#8
0
        public ZeroTouchSearchElement(FunctionDescriptor functionDescriptor)
        {
            this.functionDescriptor = functionDescriptor;

            var displayName = functionDescriptor.UserFriendlyName;

            if (functionDescriptor.IsOverloaded)
            {
                displayName += "(" + string.Join(", ", functionDescriptor.Parameters) + ")";
            }

            Name             = displayName;
            UserFriendlyName = functionDescriptor.UserFriendlyName;
            FullCategoryName = functionDescriptor.Category;
            Description      = functionDescriptor.Description;
            Assembly         = functionDescriptor.Assembly;

            ElementType = ElementTypes.ZeroTouch;

            if (functionDescriptor.IsBuiltIn)
            {
                ElementType |= ElementTypes.BuiltIn;
            }

            // Assembly, that is located in package directory, considered as part of package.
            var packageDirectories = functionDescriptor.PathManager.PackagesDirectories;

            if (packageDirectories.Any(directory => Assembly.StartsWith(directory)))
            {
                ElementType |= ElementTypes.Packaged;
            }

            inputParameters  = new List <Tuple <string, string> >(functionDescriptor.InputParameters);
            outputParameters = new List <string>()
            {
                functionDescriptor.ReturnType
            };

            foreach (var tag in functionDescriptor.GetSearchTags())
            {
                SearchKeywords.Add(tag);
            }

            var weights = functionDescriptor.GetSearchTagWeights();

            foreach (var weight in weights)
            {
                // Search tag weight can't be more then 1.
                if (weight <= 1)
                {
                    keywordWeights.Add(weight);
                }
            }

            int weightsCount = weights.Count();

            // If there weren't added weights for search tags, then add default value - 0.5
            if (weightsCount != SearchKeywords.Count)
            {
                int numberOfLackingWeights = SearchKeywords.Count - weightsCount;

                // Number of lacking weights should be more than 0.
                // It can be less then 0 only if there was some mistake in xml file.
                if (numberOfLackingWeights > 0)
                {
                    for (int i = 0; i < numberOfLackingWeights; i++)
                    {
                        keywordWeights.Add(0.5);
                    }
                }
            }

            iconName = GetIconName();
        }
示例#9
0
        public ZeroTouchSearchElement(FunctionDescriptor functionDescriptor)
        {
            this.functionDescriptor = functionDescriptor;

            Name = functionDescriptor.UserFriendlyName;

            if (functionDescriptor.IsOverloaded)
            {
                var parameters = new StringBuilder();
                parameters.Append("(");
                parameters.Append(String.Join(", ", functionDescriptor.Parameters.Select(x => x.Name)));
                parameters.Append(")");

                Parameters = parameters.ToString();
            }

            FullCategoryName = functionDescriptor.Category;
            Description      = functionDescriptor.Description;
            Assembly         = functionDescriptor.Assembly;

            ElementType = ElementTypes.ZeroTouch;

            if (functionDescriptor.IsBuiltIn)
            {
                ElementType |= ElementTypes.BuiltIn;
            }

            if (functionDescriptor.IsPackageMember)
            {
                ElementType |= ElementTypes.Packaged;
            }

            inputParameters  = new List <Tuple <string, string> >(functionDescriptor.InputParameters);
            outputParameters = new List <string>()
            {
                functionDescriptor.ReturnType.ToShortString()
            };

            foreach (var tag in functionDescriptor.GetSearchTags())
            {
                SearchKeywords.Add(tag);
            }

            var weights = functionDescriptor.GetSearchTagWeights();

            foreach (var weight in weights)
            {
                // Search tag weight can't be more then 1.
                if (weight <= 1)
                {
                    keywordWeights.Add(weight);
                }
            }

            int weightsCount = weights.Count();

            // If there weren't added weights for search tags, then add default value - 0.5
            if (weightsCount != SearchKeywords.Count)
            {
                int numberOfLackingWeights = SearchKeywords.Count - weightsCount;

                // Number of lacking weights should be more than 0.
                // It can be less then 0 only if there was some mistake in xml file.
                if (numberOfLackingWeights > 0)
                {
                    for (int i = 0; i < numberOfLackingWeights; i++)
                    {
                        keywordWeights.Add(0.5);
                    }
                }
            }

            iconName = GetIconName();
        }