Ejemplo n.º 1
0
 static void DoLoadDoc()
 {
     try {
         progress = 0;
         Assembly[] assemblies = EditorReflectionUtility.GetAssemblies();
         int        index      = 0;
         //EditorUtility.DisplayProgressBar("Loading Documentation", "", progress);
         //EditorProgressBar.ShowProgressBar("Loading Documentation", progress);
         foreach (Assembly assembly in assemblies)
         {
             try {
                 if (Thread.CurrentThread.ThreadState == ThreadState.AbortRequested)
                 {
                     break;
                 }
                 //if(uNodePreference.GetPreference().assembly.ContainsKey(assembly.GetName().Name))
                 {
                     XMLFromAssembly(assembly);
                 }
                 Thread.Sleep(1);
             }
             catch {
                 continue;
             }
             index++;
             progress = (float)index / (float)assemblies.Length;
             //EditorProgressBar.ShowProgressBar("Loading Documentation", progress);
             //EditorUtility.DisplayProgressBar("Loading Documentation", "", progress);
         }
     }
     catch { }
     //EditorUtility.ClearProgressBar();
     hasLoadDoc = true;
     isLoadDoc  = false;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Find command pin menu.
        /// </summary>
        /// <returns></returns>
        public static List <ControlFieldAttribute> FindControlsField()
        {
            if (_controlsField == null)
            {
                _controlsField = new List <ControlFieldAttribute>();

                foreach (System.Reflection.Assembly assembly in EditorReflectionUtility.GetAssemblies())
                {
                    foreach (System.Type type in EditorReflectionUtility.GetAssemblyTypes(assembly))
                    {
                        var atts = type.GetCustomAttributes(typeof(ControlFieldAttribute), true);
                        if (atts.Length > 0)
                        {
                            foreach (var a in atts)
                            {
                                var control = a as ControlFieldAttribute;
                                control.classType = type;
                                _controlsField.Add(control);
                            }
                        }
                    }
                }
                _controlsField.Sort((x, y) => Comparer <int> .Default.Compare(x.order, y.order));
            }
            return(_controlsField);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Get the actual node view type.
        /// </summary>
        /// <param name="nodeType"></param>
        /// <returns></returns>
        public static Type GetNodeViewTypeFromType(Type nodeType)
        {
            if (nodeViewPerType == null)
            {
                nodeViewPerType = new Dictionary <Type, Type>();
                foreach (var asm in EditorReflectionUtility.GetAssemblies())
                {
                    foreach (var type in EditorReflectionUtility.GetAssemblyTypes(asm))
                    {
                        if (type.IsClass && !type.IsAbstract)
                        {
                            if (type.IsSubclassOf(typeof(UNodeView)))
                            {
                                if (type.GetCustomAttributes(typeof(NodeCustomEditor), true) is NodeCustomEditor[] attrs && attrs.Length > 0)
                                {
                                    for (int i = 0; i < attrs.Length; i++)
                                    {
                                        Type nType = attrs[i].nodeType;
                                        nodeViewPerType[nType] = type;
                                    }
                                }
                            }
                        }
                    }
                }
            }
            Type oriType = nodeType;
            Type view    = null;

            while (nodeType != typeof(UNodeView) && nodeType != typeof(object) && nodeType != typeof(BaseNodeView))
            {
                if (nodeViewPerType.TryGetValue(nodeType, out view))
                {
                    if (oriType != nodeType)
                    {
                        nodeViewPerType[oriType] = view;
                    }
                    return(view);
                }
                else
                {
                    nodeType = nodeType.BaseType;
                }
            }
            return(view);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Find all available graph converters
 /// </summary>
 /// <returns></returns>
 public static List <GraphConverter> FindGraphConverters()
 {
     if (_graphConverters == null)
     {
         _graphConverters = new List <GraphConverter>();
         foreach (var assembly in EditorReflectionUtility.GetAssemblies())
         {
             try {
                 foreach (System.Type type in EditorReflectionUtility.GetAssemblyTypes(assembly))
                 {
                     if (!type.IsAbstract && type.IsSubclassOf(typeof(GraphConverter)))
                     {
                         var converter = System.Activator.CreateInstance(type, true);
                         _graphConverters.Add(converter as GraphConverter);
                     }
                 }
             }
             catch { continue; }
         }
         _graphConverters.Sort((x, y) => Comparer <int> .Default.Compare(x.order, y.order));
     }
     return(_graphConverters);
 }
Ejemplo n.º 5
0
 public static List <FieldDecorator> FindDecorators()
 {
     if (_fieldDecorators == null)
     {
         _fieldDecorators = new List <FieldDecorator>();
         foreach (var assembly in EditorReflectionUtility.GetAssemblies())
         {
             try {
                 foreach (System.Type type in EditorReflectionUtility.GetAssemblyTypes(assembly))
                 {
                     if (type.IsSubclassOf(typeof(FieldDecorator)) && ReflectionUtils.CanCreateInstance(type))
                     {
                         var control = ReflectionUtils.CreateInstance(type) as FieldDecorator;
                         _fieldDecorators.Add(control);
                     }
                 }
             }
             catch { continue; }
         }
         _fieldDecorators.Sort((x, y) => CompareUtility.Compare(x.order, y.order));
     }
     return(_fieldDecorators);
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Find all graph system attributes.
 /// </summary>
 /// <returns></returns>
 public static List <GraphSystemAttribute> FindGraphSystemAttributes()
 {
     if (_graphSystems == null)
     {
         _graphSystems = new List <GraphSystemAttribute>();
         foreach (var assembly in EditorReflectionUtility.GetAssemblies())
         {
             try {
                 foreach (System.Type type in EditorReflectionUtility.GetAssemblyTypes(assembly))
                 {
                     if (type.IsDefined(typeof(GraphSystemAttribute), false))
                     {
                         var menuItem = (GraphSystemAttribute)type.GetCustomAttributes(typeof(GraphSystemAttribute), false)[0];
                         menuItem.type = type;
                         _graphSystems.Add(menuItem);
                     }
                 }
             }
             catch { continue; }
         }
         _graphSystems.Sort((x, y) => CompareUtility.Compare(x.menu, x.order, y.menu, y.order));
     }
     return(_graphSystems);
 }
Ejemplo n.º 7
0
        public override void OnInspectorGUI()
        {
            MultiArithmeticNode node = target as MultiArithmeticNode;

            DrawDefaultInspector();
            VariableEditorUtility.DrawMembers(new GUIContent("Targets"), node.targets, node, new FilterAttribute(typeof(object)),
                                              (obj) => {
                node.targets = obj;
            },
                                              () => {
                uNodeEditorUtility.RegisterUndo(node);
                var type = node.ReturnType();
                if (type != typeof(object) && ReflectionUtils.CanCreateInstance(type))
                {
                    node.targets.Add(new MemberData(ReflectionUtils.CreateInstance(type)));
                }
                else if (node.targets.Count > 0)
                {
                    node.targets.Add(new MemberData(node.targets[node.targets.Count - 1]));
                }
                else
                {
                    node.targets.Add(new MemberData());
                }
            });
            if (GUILayout.Button(new GUIContent("Change Operator")))
            {
                var customItems = new List <ItemSelector.CustomItem>();
                {                //Primitives
                    customItems.AddRange(GetCustomItemForPrimitives(node, typeof(int)));
                    customItems.AddRange(GetCustomItemForPrimitives(node, typeof(float)));
                }
                var ns                 = NodeGraph.GetOpenedGraphUsingNamespaces();
                var preference         = uNodePreference.GetPreference();
                var assemblies         = EditorReflectionUtility.GetAssemblies();
                var includedAssemblies = uNodePreference.GetIncludedAssemblies();
                foreach (var assembly in assemblies)
                {
                    if (!includedAssemblies.Contains(assembly.GetName().Name))
                    {
                        continue;
                    }
                    var operators = EditorReflectionUtility.GetOperators(assembly, (op) => {
                        return(ns == null || ns.Contains(op.DeclaringType.Namespace));
                    });
                    if (operators.Count > 0)
                    {
                        foreach (var op in operators)
                        {
                            switch (op.Name)
                            {
                            case "op_Addition": {
                                var parameters = op.GetParameters();
                                customItems.Add(GetCustomItem(node, parameters[0].ParameterType, parameters[1].ParameterType, op.DeclaringType, op.ReturnType, ArithmeticType.Add));
                                break;
                            }

                            case "op_Subtraction": {
                                var parameters = op.GetParameters();
                                customItems.Add(GetCustomItem(node, parameters[0].ParameterType, parameters[1].ParameterType, op.DeclaringType, op.ReturnType, ArithmeticType.Subtract));
                                break;
                            }

                            case "op_Division": {
                                var parameters = op.GetParameters();
                                customItems.Add(GetCustomItem(node, parameters[0].ParameterType, parameters[1].ParameterType, op.DeclaringType, op.ReturnType, ArithmeticType.Divide));
                                break;
                            }

                            case "op_Multiply": {
                                var parameters = op.GetParameters();
                                customItems.Add(GetCustomItem(node, parameters[0].ParameterType, parameters[1].ParameterType, op.DeclaringType, op.ReturnType, ArithmeticType.Multiply));
                                break;
                            }

                            case "op_Modulus": {
                                var parameters = op.GetParameters();
                                customItems.Add(GetCustomItem(node, parameters[0].ParameterType, parameters[1].ParameterType, op.DeclaringType, op.ReturnType, ArithmeticType.Modulo));
                                break;
                            }
                            }
                        }
                    }
                }
                customItems.Sort((x, y) => {
                    if (x.category == y.category)
                    {
                        return(string.Compare(x.name, y.name));
                    }
                    return(string.Compare(x.category, y.category));
                });
                if (customItems.Count > 0)
                {
                    ItemSelector.ShowWindow(null, null, null, false, customItems).
                    ChangePosition(
                        GUIUtility.GUIToScreenRect(GUILayoutUtility.GetLastRect())
                        ).displayDefaultItem = false;
                }
            }
        }
Ejemplo n.º 8
0
        public static Assembly CompileFromFile(params string[] files)
        {
            var csharpParserType = EditorBinding.csharpParserType;

            if (csharpParserType != null)
            {
                //var method = csharpParserType.GetMethod("CompileScript", new Type[] { typeof(IEnumerable<string>) });
                //if(method != null) {
                //	List<string> scripts = new List<string>();
                //	foreach(var file in files) {
                //		scripts.Add(File.ReadAllText(file));
                //	}
                //	var compileResult = method.Invoke(null, new object[] { scripts as IEnumerable<string> }) as CompileResult;
                //	if(compileResult.assembly == null) {
                //		//compileResult.LogErrors();
                //		throw new Exception(compileResult.GetErrorMessage());
                //	}
                //	return compileResult.assembly;
                //}
                var method = csharpParserType.GetMethod("CompileFiles", new Type[] { typeof(IEnumerable <string>) });
                if (method != null)
                {
                    var compileResult = method.Invoke(null, new object[] { files as IEnumerable <string> }) as CompileResult;
                    if (compileResult.assembly == null)
                    {
                        //compileResult.LogErrors();
                        throw new Exception(compileResult.GetErrorMessage());
                    }
                    return(compileResult.assembly);
                }
            }
#if !NET_STANDARD_2_0
            var provider = new Microsoft.CSharp.CSharpCodeProvider();
            var param    = new System.CodeDom.Compiler.CompilerParameters();
            foreach (var assembly in EditorReflectionUtility.GetAssemblies())
            {
                try {
                    if (!string.IsNullOrEmpty(assembly.Location))
                    {
                        param.ReferencedAssemblies.Add(assembly.Location);
                    }
                } catch { continue; }
            }
            // Generate a dll in memory
            param.GenerateExecutable      = false;
            param.GenerateInMemory        = true;
            param.TreatWarningsAsErrors   = false;
            param.IncludeDebugInformation = true;
            //No Waring
            //param.WarningLevel = 0;
            // Compile the source
            var result = provider.CompileAssemblyFromFile(param, files);
            if (result.Errors.Count > 0)
            {
                var  msg      = new System.Text.StringBuilder();
                bool hasError = false;
                foreach (System.CodeDom.Compiler.CompilerError error in result.Errors)
                {
                    //Debug.LogError("Error (" + error.ErrorNumber + "): " + error.ErrorText + "\n");
                    if (error.IsWarning)
                    {
                        Debug.LogWarningFormat("Warning ({0}): {1}\nin line: {2}",
                                               error.ErrorNumber, error.ErrorText, error.Line);
                    }
                    else
                    {
                        hasError = true;
                        msg.AppendFormat("Error ({0}): {1}\nin line: {2}:{3}\nin file:{4}\n", error.ErrorNumber, error.ErrorText, error.Line, error.Column, error.FileName);
                    }
                }
                if (hasError)
                {
                    throw new Exception(msg.ToString());
                }
            }

            // Return the assembly
            return(result.CompiledAssembly);
#else
            Debug.Log("Compiling script is disable due to unsupported in .NET Standard 2.0, change API compativility level to .NET 4.x to enable it or import CSharp Parser add-ons to compile with Roslyn instead.");
            return(null);
#endif
        }
Ejemplo n.º 9
0
        public static CompileResult CompileScript(params string[] source)
        {
            var csharpParserType = EditorBinding.csharpParserType;

            if (csharpParserType != null)
            {
                var method = csharpParserType.GetMethod("CompileScript", new Type[] { typeof(IEnumerable <string>) });
                if (method != null)
                {
                    return(method.Invoke(null, new object[] { source as IEnumerable <string> }) as CompileResult);
                }
            }
#if !NET_STANDARD_2_0
            var provider = new Microsoft.CSharp.CSharpCodeProvider();
            var param    = new System.CodeDom.Compiler.CompilerParameters();
            foreach (var assembly in EditorReflectionUtility.GetAssemblies())
            {
                try {
                    if (!string.IsNullOrEmpty(assembly.Location))
                    {
                        param.ReferencedAssemblies.Add(assembly.Location);
                    }
                } catch { continue; }
            }
            // Generate a dll in memory
            param.GenerateExecutable      = false;
            param.GenerateInMemory        = true;
            param.TreatWarningsAsErrors   = false;
            param.IncludeDebugInformation = true;
            Directory.CreateDirectory(tempGeneratedFolder);
            param.TempFiles = new System.CodeDom.Compiler.TempFileCollection(tempGeneratedFolder, true);
            //No Waring
            //param.WarningLevel = 0;
            // Compile the source
            var result = provider.CompileAssemblyFromSource(param, source);

            List <CompileResult.CompileError> compileErrors = new List <CompileResult.CompileError>();
            if (result.Errors.Count > 0)
            {
                foreach (System.CodeDom.Compiler.CompilerError error in result.Errors)
                {
                    compileErrors.Add(new CompileResult.CompileError()
                    {
                        fileName    = error.FileName,
                        isWarning   = error.IsWarning,
                        errorText   = error.ErrorText,
                        errorNumber = error.ErrorNumber,
                        errorLine   = error.Line,
                        errorColumn = error.Column,
                    });
                }
            }

            // Return the assembly
            return(new CompileResult()
            {
                assembly = result.CompiledAssembly,
                errors = compileErrors,
            });
#else
            Debug.Log("Compiling script is disable due to unsupported in .NET Standard 2.0, change API compativility level to .NET 4.x to enable it or import CSharp Parser add-ons to compile with Roslyn instead.");
            return(new CompileResult());
#endif
        }
Ejemplo n.º 10
0
        public void Init()
        {
            //int typeCount = 0;
            Dictionary <string, List <Type> > typeMaps = new Dictionary <string, List <Type> >();
            var namespaces    = uNodePreference.GetBrowserNamespaceList();
            var excludedNS    = uNodePreference.GetExcludedNamespace();
            var excludedTypes = uNodePreference.GetExcludedTypes();

            foreach (var assembly in EditorReflectionUtility.GetAssemblies())
            {
                string assemblyName = assembly.GetName().Name;
                foreach (var type in EditorReflectionUtility.GetAssemblyTypes(assembly))
                {
                    if (type.IsNotPublic ||
                        !type.IsVisible ||
                        type.IsEnum ||
                        type.IsInterface ||
                        type.IsCOMObject ||
                        type.IsAutoClass ||
                        type.IsGenericType ||
                        type.Name.StartsWith("<") ||
                        type.IsCastableTo(typeof(Delegate)) ||
                        type.IsDefined(typeof(ObsoleteAttribute), true) ||
                        excludedTypes.Contains(type.FullName))
                    {
                        continue;
                    }
                    string ns = type.Namespace;
                    //if(ns.StartsWith("Unity.") || ns.Contains("Experimental") || ns.Contains("Internal")) {
                    //	continue;
                    //}
                    if (string.IsNullOrEmpty(ns))
                    {
                        ns = "global";
                    }
                    else if (!namespaces.Contains(ns))
                    {
                        continue;
                    }
                    if (excludedNS.Contains(ns))
                    {
                        continue;
                    }
                    List <Type> types;
                    if (!typeMaps.TryGetValue(ns, out types))
                    {
                        types        = new List <Type>();
                        typeMaps[ns] = types;
                    }
                    types.Add(type);
                    //typeCount++;
                }
            }
            //this.typeCount = typeCount;
            typeList = typeMaps.ToList();
            foreach (var list in typeList)
            {
                list.Value.Sort((x, y) => string.Compare(x.Name, y.Name));
            }
            typeList.Sort((x, y) => {
                if (x.Key == "global")
                {
                    if (y.Key == "global")
                    {
                        return(0);
                    }
                    return(-1);
                }
                else if (y.Key == "global")
                {
                    return(1);
                }
                if (x.Key.StartsWith("Unity"))
                {
                    if (y.Key.StartsWith("Unity"))
                    {
                        return(string.Compare(x.Key, y.Key));
                    }
                    return(-1);
                }
                else if (y.Key.StartsWith("Unity"))
                {
                    return(1);
                }
                return(string.Compare(x.Key, y.Key));
            });
        }
Ejemplo n.º 11
0
        public override IList <ItemSelector.CustomItem> GetItems(Node source, MemberData data, System.Type type)
        {
            var items = new List <ItemSelector.CustomItem>();

            if (type.IsPrimitive && type != typeof(bool) && type != typeof(char))
            {
                string typeName = type.PrettyName();
                items.Add(new ItemSelector.CustomItem(string.Format("Add ({0}, {0})", typeName), () => {
                    NodeEditorUtility.AddNewNode(graph.editorData, null, null, mousePositionOnCanvas, (MultiArithmeticNode n) => {
                        n.targets[0]   = data;
                        n.targets[1]   = new MemberData(ReflectionUtils.CreateInstance(type));
                        n.operatorType = ArithmeticType.Add;
                        graph.Refresh();
                    });
                }, "Operator")
                {
                    icon = uNodeEditorUtility.GetTypeIcon(type)
                });
                items.Add(new ItemSelector.CustomItem(string.Format("Subtract ({0}, {0})", typeName), () => {
                    NodeEditorUtility.AddNewNode(graph.editorData, null, null, mousePositionOnCanvas, (MultiArithmeticNode n) => {
                        n.targets[0]   = data;
                        n.targets[1]   = new MemberData(ReflectionUtils.CreateInstance(type));
                        n.operatorType = ArithmeticType.Subtract;
                        graph.Refresh();
                    });
                }, "Operator")
                {
                    icon = uNodeEditorUtility.GetTypeIcon(type)
                });
                items.Add(new ItemSelector.CustomItem(string.Format("Divide ({0}, {0})", typeName), () => {
                    NodeEditorUtility.AddNewNode(graph.editorData, null, null, mousePositionOnCanvas, (MultiArithmeticNode n) => {
                        n.targets[0]   = data;
                        n.targets[1]   = new MemberData(ReflectionUtils.CreateInstance(type));
                        n.operatorType = ArithmeticType.Divide;
                        graph.Refresh();
                    });
                }, "Operator")
                {
                    icon = uNodeEditorUtility.GetTypeIcon(type)
                });
                items.Add(new ItemSelector.CustomItem(string.Format("Multiply ({0}, {0})", typeName), () => {
                    NodeEditorUtility.AddNewNode(graph.editorData, null, null, mousePositionOnCanvas, (MultiArithmeticNode n) => {
                        n.targets[0]   = data;
                        n.targets[1]   = new MemberData(ReflectionUtils.CreateInstance(type));
                        n.operatorType = ArithmeticType.Multiply;
                        graph.Refresh();
                    });
                }, "Operator")
                {
                    icon = uNodeEditorUtility.GetTypeIcon(type)
                });
                items.Add(new ItemSelector.CustomItem(string.Format("Modulo ({0}, {0})", typeName), () => {
                    NodeEditorUtility.AddNewNode(graph.editorData, null, null, mousePositionOnCanvas, (MultiArithmeticNode n) => {
                        n.targets[0]   = data;
                        n.targets[1]   = new MemberData(ReflectionUtils.CreateInstance(type));
                        n.operatorType = ArithmeticType.Modulo;
                        graph.Refresh();
                    });
                }, "Operator")
                {
                    icon = uNodeEditorUtility.GetTypeIcon(type)
                });
            }

            var preference         = uNodePreference.GetPreference();
            var assemblies         = EditorReflectionUtility.GetAssemblies();
            var includedAssemblies = uNodePreference.GetIncludedAssemblies();
            var ns = graph.editorData.GetNamespaces();

            foreach (var assembly in assemblies)
            {
                if (!includedAssemblies.Contains(assembly.GetName().Name))
                {
                    continue;
                }
                var operators = EditorReflectionUtility.GetOperators(assembly, (op) => {
                    return(ns.Contains(op.DeclaringType.Namespace));
                });
                if (operators.Count > 0)
                {
                    foreach (var op in operators)
                    {
                        switch (op.Name)
                        {
                        case "op_Addition": {
                            var parameters = op.GetParameters();
                            if (parameters[0].ParameterType != type && parameters[1].ParameterType != type)
                            {
                                break;
                            }
                            items.Add(GetItem(type, parameters[0].ParameterType, parameters[1].ParameterType, op.ReturnType, data, ArithmeticType.Add));
                            break;
                        }

                        case "op_Subtraction": {
                            var parameters = op.GetParameters();
                            if (parameters[0].ParameterType != type && parameters[1].ParameterType != type)
                            {
                                break;
                            }
                            items.Add(GetItem(type, parameters[0].ParameterType, parameters[1].ParameterType, op.ReturnType, data, ArithmeticType.Subtract));
                            break;
                        }

                        case "op_Division": {
                            var parameters = op.GetParameters();
                            if (parameters[0].ParameterType != type && parameters[1].ParameterType != type)
                            {
                                break;
                            }
                            items.Add(GetItem(type, parameters[0].ParameterType, parameters[1].ParameterType, op.ReturnType, data, ArithmeticType.Divide));
                            break;
                        }

                        case "op_Multiply": {
                            var parameters = op.GetParameters();
                            if (parameters[0].ParameterType != type && parameters[1].ParameterType != type)
                            {
                                break;
                            }
                            items.Add(GetItem(type, parameters[0].ParameterType, parameters[1].ParameterType, op.ReturnType, data, ArithmeticType.Multiply));
                            break;
                        }

                        case "op_Modulus": {
                            var parameters = op.GetParameters();
                            if (parameters[0].ParameterType != type && parameters[1].ParameterType != type)
                            {
                                break;
                            }
                            items.Add(GetItem(type, parameters[0].ParameterType, parameters[1].ParameterType, op.ReturnType, data, ArithmeticType.Modulo));
                            break;
                        }
                        }
                    }
                }
            }
            items.Sort((x, y) => string.Compare(x.name, y.name));
            return(items);
        }
Ejemplo n.º 12
0
        public override IList <ItemSelector.CustomItem> GetItems(Node source, MemberData data, System.Type type)
        {
            var items = new List <ItemSelector.CustomItem>();

            if (type.IsPrimitive && type != typeof(bool) && type != typeof(char))             //Primitives
            {
                items.AddRange(GetCustomItemForPrimitives(type, data));
            }
            else
            {
                items.Add(GetItem(type, type, type, typeof(bool), data, ComparisonType.Equal));
                items.Add(GetItem(type, type, type, typeof(bool), data, ComparisonType.NotEqual));
            }
            var preference         = uNodePreference.GetPreference();
            var assemblies         = EditorReflectionUtility.GetAssemblies();
            var includedAssemblies = uNodePreference.GetIncludedAssemblies();
            var ns = graph.editorData.GetNamespaces();

            foreach (var assembly in assemblies)
            {
                if (!includedAssemblies.Contains(assembly.GetName().Name))
                {
                    continue;
                }
                var operators = EditorReflectionUtility.GetOperators(assembly, (op) => {
                    return(ns.Contains(op.DeclaringType.Namespace));
                });
                if (operators.Count > 0)
                {
                    foreach (var op in operators)
                    {
                        switch (op.Name)
                        {
                        //case "op_Equality": {
                        //	var parameters = op.GetParameters();
                        //	if(parameters[0].ParameterType != type && parameters[1].ParameterType != type)
                        //		break;
                        //	items.Add(GetItem(type, parameters[0].ParameterType, parameters[1].ParameterType, op.ReturnType, data, ComparisonType.Equal));
                        //	break;
                        //}
                        //case "op_Inequality": {
                        //	var parameters = op.GetParameters();
                        //	if(parameters[0].ParameterType != type && parameters[1].ParameterType != type)
                        //		break;
                        //	items.Add(GetItem(type, parameters[0].ParameterType, parameters[1].ParameterType, op.ReturnType, data, ComparisonType.NotEqual));
                        //	break;
                        //}
                        case "op_LessThan": {
                            var parameters = op.GetParameters();
                            if (parameters[0].ParameterType != type && parameters[1].ParameterType != type)
                            {
                                break;
                            }
                            items.Add(GetItem(type, parameters[0].ParameterType, parameters[1].ParameterType, op.ReturnType, data, ComparisonType.LessThan));
                            break;
                        }

                        case "op_GreaterThan": {
                            var parameters = op.GetParameters();
                            if (parameters[0].ParameterType != type && parameters[1].ParameterType != type)
                            {
                                break;
                            }
                            items.Add(GetItem(type, parameters[0].ParameterType, parameters[1].ParameterType, op.ReturnType, data, ComparisonType.GreaterThan));
                            break;
                        }

                        case "op_LessThanOrEqual": {
                            var parameters = op.GetParameters();
                            if (parameters[0].ParameterType != type && parameters[1].ParameterType != type)
                            {
                                break;
                            }
                            items.Add(GetItem(type, parameters[0].ParameterType, parameters[1].ParameterType, op.ReturnType, data, ComparisonType.LessThanOrEqual));
                            break;
                        }

                        case "op_GreaterThanOrEqual": {
                            var parameters = op.GetParameters();
                            if (parameters[0].ParameterType != type && parameters[1].ParameterType != type)
                            {
                                break;
                            }
                            items.Add(GetItem(type, parameters[0].ParameterType, parameters[1].ParameterType, op.ReturnType, data, ComparisonType.GreaterThanOrEqual));
                            break;
                        }
                        }
                    }
                }
            }
            items.Sort((x, y) => string.Compare(x.name, y.name));
            return(items);
        }