Exemplo n.º 1
0
        private static void resetPar(NodeTag.DefaultObject obj, ParInfo par, string newName)
        {
            Node node = getNode(obj);

            if (node != null && par != null)
            {
                Type type = obj.GetType();
                foreach (PropertyInfo property in type.GetProperties())
                {
                    try
                    {
                        object value = property.GetValue(obj, null);
                        if (value != null)
                        {
                            if (property.PropertyType == typeof(MethodDef))
                            {
                                MethodDef method = value as MethodDef;
                                Debug.Check(method != null);

                                method.ResetPar(par, newName);
                            }
                            else if (property.PropertyType == typeof(VariableDef))
                            {
                                VariableDef var = value as VariableDef;
                                Debug.Check(var != null);

                                var.ResetPar(par, newName);
                            }
                            else if (property.PropertyType == typeof(RightValueDef))
                            {
                                RightValueDef rv = value as RightValueDef;
                                Debug.Check(rv != null);

                                rv.ResetPar(par, newName);
                            }
                        }
                    }
                    catch
                    {
                    }
                }
            }
        }
Exemplo n.º 2
0
        private static void checkPar(NodeTag.DefaultObject obj, ParInfo par, ref List<Node.ErrorCheck> result)
        {
            Node node = getNode(obj);

            if (node != null && par != null)
            {
                Type type = obj.GetType();
                foreach (PropertyInfo property in type.GetProperties())
                {
                    try
                    {
                        object value = property.GetValue(obj, null);
                        if (value != null)
                        {
                            if (property.PropertyType == typeof(MethodDef))
                            {
                                MethodDef method = value as MethodDef;
                                Debug.Check(method != null);

                                if (method.CheckPar(par))
                                    result.Add(new Node.ErrorCheck(node, ErrorCheckLevel.Error, "Par as a parameter of the method."));
                            }
                            else if (property.PropertyType == typeof(VariableDef))
                            {
                                VariableDef var = value as VariableDef;
                                Debug.Check(var != null);

                                if (var.CheckPar(par))
                                    result.Add(new Node.ErrorCheck(node, ErrorCheckLevel.Error, "Par as a value."));
                            }
                            else if (property.PropertyType == typeof(RightValueDef))
                            {
                                RightValueDef rv = value as RightValueDef;
                                Debug.Check(rv != null);

                                if (rv.CheckPar(par))
                                    result.Add(new Node.ErrorCheck(node, ErrorCheckLevel.Error, "Par as a right value."));
                            }
                        }
                    }
                    catch
                    {
                    }
                }
            }
        }