예제 #1
0
        private string Callsutmethods(string input)
        {
            string         output  = "";
            Object         ob      = null;;
            Abstractmethod _method = Abstractiontable.Getmethod(input);

            if (_method != null)
            {
                if (_method.concretemethod.method.IsPublic)
                {
                    object[] _inputs = new object[_method.parameters.Count];
                    int      cnt     = 0;
                    foreach (var item in _method.parameters)
                    {
                        _inputs[cnt] = Convert.ChangeType(item.value, item.param.ParameterType);
                        cnt++;
                    }
                    ///
                    ob = _method.concretemethod.method.Invoke(null, _inputs);
                    ///
                }
                else if (_method.concretemethod.method.IsPrivate)
                {
                    object[] _inputs = new object[_method.parameters.Count];
                    int      cnt     = 0;
                    foreach (var item in _method.parameters)
                    {
                        _inputs[cnt] = Convert.ChangeType(item.value, item.param.ParameterType);
                        cnt++;
                    }
                    MethodInfo dynMethod = _method.concretemethod.method.DeclaringType.GetMethod(_method.concretemethod.method.Name,
                                                                                                 BindingFlags.NonPublic | BindingFlags.Instance);
                    ob = dynMethod.Invoke(null, _inputs);
                }
            }
            if (ob != null)
            {
                if (Convert.ToBoolean(ob) == true)
                {
                    output = _method.abstractvalue + "-OK";
                }
                else
                {
                    output = _method.abstractvalue + "-NOK";
                }
            }
            return(output);
        }
예제 #2
0
        private static void Additem(object[] y, string methodname, string symbol)
        {
            Method _m1 = Callgraph.listmethods.Where(p => p.method.Name.Equals(methodname)).Single();

            ParameterInfo[]  param1 = _m1.method.GetParameters();
            List <Parameter> p11    = new List <Parameter>();

            for (int i = 0; i < param1.Length; i++)
            {
                Parameter p2 = new Parameter(param1[i], y[i]);
                p11.Add(p2);
            }

            Abstractmethod abs1 = new Abstractmethod(symbol, _m1, p11, "TRUE");

            Abstractiontable.Additem(abs1);
        }
예제 #3
0
 public static void Additem(Abstractmethod abs)
 {
     abstractmethods.Add(abs);
 }