public static Property LoadRight(string value, ref string typeName) { Property opr = null; if (!string.IsNullOrEmpty(value)) { if (value.StartsWith("const")) { //const Int32 0 const int kConstLength = 5; string strRemaining = value.Substring(kConstLength + 1); int p = StringUtils.FirstToken(strRemaining, ' ', ref typeName); typeName = typeName.Replace("::", "."); string strVale = strRemaining.Substring(p + 1); opr = Property.Create(typeName, strVale); } else { opr = ParseProperty(value, ref typeName); } } return(opr); }
public static Property LoadLeft(string value, ref string propertyName, string constValue) { Property opl = null; if (!string.IsNullOrEmpty(value)) { string[] tokens = value.Split(' '); if (tokens != null && tokens.Length == 2) { //int AgentTest::Property1 string typeName = tokens[0].Replace("::", "."); propertyName = tokens[1]; opl = Property.Create(typeName, tokens[1], constValue, false, false); } else { //static int AgentTest::Property6 Debug.Check(tokens[0] == "static"); string typeName = tokens[1].Replace("::", "."); propertyName = tokens[2]; opl = Property.Create(typeName, tokens[2], constValue, true, false); } } return(opl); }
public static Property LoadRight(string value, string propertyName, ref string typeName) { Property property = null; if (string.IsNullOrEmpty(value)) { return(property); } if (value.StartsWith("const")) { string str = value.Substring(6); int num2 = StringUtils.FirstToken(str, ' ', ref typeName); typeName = typeName.Replace("::", "."); string str2 = str.Substring(num2 + 1); return(Property.Create(typeName, propertyName, str2, false, true)); } char[] separator = new char[] { ' ' }; string[] strArray = value.Split(separator); if (strArray[0] == "static") { typeName = strArray[1].Replace("::", "."); return(Property.Create(typeName, strArray[2], null, true, false)); } typeName = strArray[0].Replace("::", "."); return(Property.Create(typeName, strArray[1], null, false, false)); }
public static Property ParseProperty(string value, ref string typeName) { Property opr = null; List <string> tokens = StringUtils.SplitTokens(value); if (tokens[0] == "static") { //static int Property1 typeName = tokens[1].Replace("::", "."); if (tokens.Count == 3) { opr = Property.Create(typeName, tokens[2], null, true, false); } else { Debug.Check(tokens.Count == 4); opr = Property.Create(typeName, tokens[2], tokens[3], true, false); } } else { //int Property1 typeName = tokens[0].Replace("::", "."); if (tokens.Count == 2) { opr = Property.Create(typeName, tokens[1], null, false, false); } else { opr = Property.Create(typeName, tokens[1], tokens[2], false, false); } } return(opr); }
public static Property LoadRight(string value, string propertyName, ref string typeName) { Property result = null; if (!string.IsNullOrEmpty(value)) { if (value.StartsWith("const")) { string text = value.Substring(6); int num = StringUtils.FirstToken(text, ' ', ref typeName); typeName = typeName.Replace("::", "."); string value2 = text.Substring(num + 1); result = Property.Create(typeName, propertyName, value2, false, true); } else { string[] array = value.Split(new char[] { ' ' }); if (array[0] == "static") { typeName = array[1].Replace("::", "."); result = Property.Create(typeName, array[2], null, true, false); } else { typeName = array[0].Replace("::", "."); result = Property.Create(typeName, array[1], null, false, false); } } } return(result); }
public static Property LoadLeft(string value, ref string propertyName, string constValue) { Property result = null; if (!string.IsNullOrEmpty(value)) { string[] array = value.Split(new char[] { ' ' }); if (array != null && array.Length == 2) { string typeName = array[0].Replace("::", "."); propertyName = array[1]; result = Property.Create(typeName, array[1], constValue, false, false); } else { DebugHelper.Assert(array != null && array.Length > 0 && array[0] == "static"); string typeName2 = array[1].Replace("::", "."); propertyName = array[2]; result = Property.Create(typeName2, array[2], constValue, true, false); } } return(result); }
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; } } } } } }
private Property AddProperty(string typeName, bool bIsStatic, string variableName, string valueStr, string agentType) { Property pProperty = Property.Create(typeName, "Self", agentType, variableName, valueStr); pProperty.IsStatic = bIsStatic; pProperty.NativeTypeName = typeName; uint variableId = Utils.MakeVariableId(variableName); this.m_properties[variableId] = pProperty; return(pProperty); }
public static bool ParseForStruct(Type type, string str, ref string strT, DictionaryView <string, Property> props) { int num = 0; for (int i = 0; i < str.get_Length(); i++) { char c = str.get_Chars(i); if (c == ';' || c == '{' || c == '}') { int j = num; while (j <= i) { strT += str.get_Chars(j++); } num = i + 1; } else if (c == ' ') { string text = string.Empty; int num2 = num; while (str.get_Chars(num2) != '=') { text += str.get_Chars(num2++); } num2++; string text2 = string.Empty; while (str.get_Chars(num2) != ' ') { text2 += str.get_Chars(num2++); } bool bStatic = false; if (text2 == "static") { num2++; while (str.get_Chars(num2) != ' ') { text2 += str.get_Chars(num2++); } bStatic = true; } string text3 = string.Empty; i++; while (str.get_Chars(i) != ';') { text3 += str.get_Chars(i++); } props[text] = Property.Create(text2, text3, null, bStatic, false); num = i + 1; } } return(true); }
public void AddPar(string type, string name, string value, string eventParam) { Property property = Property.Create(type, name, value, false, false); if (!string.IsNullOrEmpty(eventParam)) { property.SetRefName(eventParam); } if (this.m_pars == null) { this.m_pars = new ListView <Property>(); } this.m_pars.Add(property); }
private Property AddLocal(string typeName, string variableName, string valueStr) { Debug.Check(!variableName.EndsWith("]")); string agentType = null; Property pProperty = Property.Create(typeName, "Self", agentType, variableName, valueStr); pProperty.IsLocal = true; pProperty.NativeTypeName = typeName; uint variableId = Utils.MakeVariableId(variableName); this.m_locals[variableId] = pProperty; return(pProperty); }
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; } } } } } }
public static Property LoadRight(string value, string propertyName, ref string typeName) { Property opr = null; if (!string.IsNullOrEmpty(value)) { if (value.StartsWith("const")) { //const Int32 0 const int kConstLength = 5; string strRemaining = value.Substring(kConstLength + 1); int p = StringUtils.FirstToken(strRemaining, ' ', ref typeName); typeName = typeName.Replace("::", "."); string strVale = strRemaining.Substring(p + 1); opr = Property.Create(typeName, propertyName, strVale, false, true); } else { string[] tokens = value.Split(' '); if (tokens[0] == "static") { //static int Property1 Debug.Check(tokens.Length == 3); typeName = tokens[1].Replace("::", "."); opr = Property.Create(typeName, tokens[2], null, true, false); } else { //int Property1 Debug.Check(tokens.Length == 2); typeName = tokens[0].Replace("::", "."); opr = Property.Create(typeName, tokens[1], null, false, false); } } } return(opr); }
public static Property LoadLeft(string value, ref string propertyName, string constValue) { Property property = null; if (string.IsNullOrEmpty(value)) { return(property); } char[] separator = new char[] { ' ' }; string[] strArray = value.Split(separator); if ((strArray != null) && (strArray.Length == 2)) { string str = strArray[0].Replace("::", "."); propertyName = strArray[1]; return(Property.Create(str, strArray[1], constValue, false, false)); } DebugHelper.Assert(((strArray != null) && (strArray.Length > 0)) && (strArray[0] == "static")); string typeName = strArray[1].Replace("::", "."); propertyName = strArray[2]; return(Property.Create(typeName, strArray[2], constValue, true, false)); }
public virtual Property CreateProperty(string defaultValue, bool bConst) { return(Property.Create(defaultValue, null, bConst)); }
public static bool ParseForStruct(System.Type type, string str, ref string strT, DictionaryView <string, Property> props) { int num = 0; for (int i = 0; i < str.Length; i++) { char ch = str[i]; switch (ch) { case ';': case '{': case '}': { int num3 = num; while (num3 <= i) { strT = strT + str[num3++]; } num = i + 1; break; } default: if (ch == ' ') { string str2 = string.Empty; int num4 = num; while (str[num4] != '=') { str2 = str2 + str[num4++]; } num4++; string typeName = string.Empty; while (str[num4] != ' ') { typeName = typeName + str[num4++]; } bool bStatic = false; if (typeName == "static") { num4++; while (str[num4] != ' ') { typeName = typeName + str[num4++]; } bStatic = true; } string variableName = string.Empty; i++; while (str[i] != ';') { variableName = variableName + str[i++]; } props[str2] = Property.Create(typeName, variableName, null, bStatic, false); num = i + 1; } break; } } return(true); }