示例#1
0
 public static Property Create(string typeName, string variableName, string value, bool bStatic, bool bConst)
 {
     if (!bConst)
     {
         string instanceName = null;
         bool   flag         = Utils.IsParVar(variableName);
         string text;
         if (flag)
         {
             text = string.Format("{0}::{1}", typeName, variableName);
         }
         else
         {
             text = Property.ParseInstanceNameProperty(variableName, ref instanceName);
         }
         bool flag2 = false;
         if (!string.IsNullOrEmpty(text))
         {
             flag2 = Property.ms_properties.ContainsKey(text);
         }
         if (!flag2)
         {
             Property property = Property.create(flag, bConst, typeName, text, instanceName, value);
             if (!string.IsNullOrEmpty(text))
             {
                 Property.ms_properties.set_Item(text, property);
             }
             return(property.clone());
         }
         Property property2 = Property.ms_properties.get_Item(text);
         Property property3 = property2.clone();
         if (!string.IsNullOrEmpty(value) && !Property.IsAgentPtr(typeName, value))
         {
             property3.SetDefaultValue(value);
         }
         return(property3);
     }
     else
     {
         CMemberBase cMemberBase   = null;
         bool        flag3         = !string.IsNullOrEmpty(variableName);
         string      instanceName2 = null;
         string      text2         = variableName;
         if (flag3)
         {
             text2       = Property.ParseInstanceNameProperty(variableName, ref instanceName2);
             cMemberBase = Agent.FindMemberBase(text2);
         }
         if (cMemberBase != null)
         {
             return(cMemberBase.CreateProperty(value, true));
         }
         bool bParVar = flag3 && Utils.IsParVar(variableName);
         return(Property.create(bParVar, bConst, typeName, text2, instanceName2, value));
     }
 }
示例#2
0
        private static Property create(bool bParVar, bool bConst, string typeName, string variableName, string instanceName, string valueStr)
        {
            bool flag = !string.IsNullOrEmpty(variableName);

            if (flag && !bParVar)
            {
                Property property = Agent.CreateProperty(typeName, variableName, valueStr);
                if (flag && property != null && !bConst)
                {
                    property.SetVariableName(variableName);
                    property.SetInstanceNameString(instanceName);
                }
                return(property);
            }
            bool     flag2     = Property.IsAgentPtr(typeName, valueStr);
            Property property2 = new Property(null, bConst);
            object   defaultValue;

            if (!flag2)
            {
                bool flag3 = false;
                if (typeName.StartsWith("vector<"))
                {
                    flag3 = true;
                }
                Type typeFromName;
                if (flag3)
                {
                    int    num       = typeName.IndexOf('<');
                    int    num2      = typeName.IndexOf('>');
                    int    num3      = num2 - num - 1;
                    string typeName2 = typeName.Substring(num + 1, num3);
                    typeFromName = Property.GetTypeFromName(typeName2);
                }
                else
                {
                    typeFromName = Property.GetTypeFromName(typeName);
                }
                defaultValue = StringUtils.FromString(typeFromName, valueStr, flag3);
            }
            else
            {
                defaultValue = null;
            }
            property2.SetDefaultValue(defaultValue);
            if (flag && property2 != null && !bConst)
            {
                property2.SetVariableName(variableName);
            }
            return(property2);
        }