예제 #1
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);
        }