Esempio n. 1
0
 public void Load(Agent parent, List <string> paramsToken)
 {
     ParameterInfo[] parameters = this.method_.GetParameters();
     this.m_param_values = new object[parameters.Length];
     if (paramsToken.get_Count() == parameters.Length)
     {
         this.m_params = new CMethodBase.Param_t[parameters.Length];
         for (int i = 0; i < paramsToken.get_Count(); i++)
         {
             ParameterInfo parameterInfo = parameters[i];
             bool          flag          = paramsToken.get_Item(i).get_Chars(0) == '{';
             if (flag)
             {
                 DictionaryView <string, Property> dictionaryView = new DictionaryView <string, Property>();
                 string empty = string.Empty;
                 if (StringUtils.ParseForStruct(parameterInfo.get_ParameterType(), paramsToken.get_Item(i), ref empty, dictionaryView))
                 {
                     object obj = StringUtils.FromString(parameterInfo.get_ParameterType(), empty, false);
                     this.m_param_values[i] = obj;
                     this.m_params[i].paramStructMembers = dictionaryView;
                 }
             }
             else
             {
                 bool flag2 = paramsToken.get_Item(i).get_Chars(0) == '"';
                 if (flag2 || paramsToken.get_Item(i).IndexOf(' ') == -1)
                 {
                     string valStr = (!flag2) ? paramsToken.get_Item(i) : paramsToken.get_Item(i).Substring(1, paramsToken.get_Item(i).get_Length() - 2);
                     object obj2   = StringUtils.FromString(parameterInfo.get_ParameterType(), valStr, false);
                     this.m_param_values[i] = obj2;
                 }
                 else
                 {
                     string[] array = paramsToken.get_Item(i).Split(new char[]
                     {
                         ' '
                     });
                     if (array.Length == 2)
                     {
                         string   typeName      = array[0].Replace("::", ".");
                         Property paramProperty = Property.Create(typeName, array[1], null, false, false);
                         this.m_params[i].paramProperty = paramProperty;
                     }
                     else if (array.Length == 3)
                     {
                         string   typeName2      = array[1].Replace("::", ".");
                         Property paramProperty2 = Property.Create(typeName2, array[2], null, true, false);
                         this.m_params[i].paramProperty = paramProperty2;
                     }
                 }
             }
         }
     }
 }
Esempio n. 2
0
 public void Load(Agent parent, List <string> paramsToken)
 {
     ParameterInfo[] parameters = this.method_.GetParameters();
     this.m_param_values = new object[parameters.Length];
     if (paramsToken.Count == parameters.Length)
     {
         this.m_params = new Param_t[parameters.Length];
         for (int i = 0; i < paramsToken.Count; i++)
         {
             ParameterInfo info = parameters[i];
             if (paramsToken[i][0] == '{')
             {
                 DictionaryView <string, Property> props = new DictionaryView <string, Property>();
                 string strT = string.Empty;
                 if (StringUtils.ParseForStruct(info.ParameterType, paramsToken[i], ref strT, props))
                 {
                     this.m_param_values[i] = StringUtils.FromString(info.ParameterType, strT, false);
                     this.m_params[i].paramStructMembers = props;
                 }
             }
             else
             {
                 bool flag2 = paramsToken[i][0] == '"';
                 if (flag2 || (paramsToken[i].IndexOf(' ') == -1))
                 {
                     string valStr = !flag2 ? paramsToken[i] : paramsToken[i].Substring(1, paramsToken[i].Length - 2);
                     this.m_param_values[i] = StringUtils.FromString(info.ParameterType, valStr, false);
                 }
                 else
                 {
                     char[]   separator = new char[] { ' ' };
                     string[] strArray  = paramsToken[i].Split(separator);
                     if (strArray.Length == 2)
                     {
                         Property property = Property.Create(strArray[0].Replace("::", "."), strArray[1], null, false, false);
                         this.m_params[i].paramProperty = property;
                     }
                     else if (strArray.Length == 3)
                     {
                         Property property2 = Property.Create(strArray[1].Replace("::", "."), strArray[2], null, true, false);
                         this.m_params[i].paramProperty = property2;
                     }
                 }
             }
         }
     }
 }