public static Property Create(string value, CMemberBase pMemberBase, bool bConst) { Property property = new Property(pMemberBase, bConst); if (string.IsNullOrEmpty(value) || property.SetDefaultValue(value)) { } return(property); }
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)); } }
public virtual Property CreateProperty(string defaultValue, bool bConst) { Property property = new Property(this, bConst); if (!string.IsNullOrEmpty(defaultValue)) { property.SetDefaultValue(defaultValue); } return(property); }
public static Property Create(string typeName, string variableName, string value, bool bStatic, bool bConst) { if (!bConst) { string str = null; string str2 = null; bool flag = Utils.IsParVar(variableName); if (flag) { str2 = string.Format("{0}::{1}", typeName, variableName); } else { str2 = ParseInstanceNameProperty(variableName, ref str); } bool flag2 = false; if (!string.IsNullOrEmpty(str2)) { flag2 = ms_properties.ContainsKey(str2); } if (!flag2) { Property property = create(flag, bConst, typeName, str2, str, value); if (!string.IsNullOrEmpty(str2)) { ms_properties[str2] = property; } return(property.clone()); } Property property4 = ms_properties[str2].clone(); if (!string.IsNullOrEmpty(value) && !IsAgentPtr(typeName, value)) { property4.SetDefaultValue(value); } return(property4); } CMemberBase base2 = null; bool flag4 = !string.IsNullOrEmpty(variableName); string instanceName = null; string propertyName = variableName; if (flag4) { propertyName = ParseInstanceNameProperty(variableName, ref instanceName); base2 = Agent.FindMemberBase(propertyName); } if (base2 != null) { return(base2.CreateProperty(value, true)); } bool bParVar = flag4 && Utils.IsParVar(variableName); return(create(bParVar, bConst, typeName, propertyName, instanceName, value)); }
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); }
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 = IsAgentPtr(typeName, valueStr); Property property2 = new Property(null, bConst); object v = null; if (!flag2) { bool bStrIsArrayType = false; if (typeName.StartsWith("vector<")) { bStrIsArrayType = true; } System.Type typeFromName = null; if (bStrIsArrayType) { int index = typeName.IndexOf('<'); int length = (typeName.IndexOf('>') - index) - 1; typeFromName = GetTypeFromName(typeName.Substring(index + 1, length)); } else { typeFromName = GetTypeFromName(typeName); } v = StringUtils.FromString(typeFromName, valueStr, bStrIsArrayType); } else { v = null; } property2.SetDefaultValue(v); if ((flag && (property2 != null)) && !bConst) { property2.SetVariableName(variableName); } return(property2); }
public static Property Create(string value, CMemberBase pMemberBase, bool bConst) { Property p = new Property(pMemberBase, bConst); //a const must have default value Debug.Check(!bConst || !string.IsNullOrEmpty(value)); if (!string.IsNullOrEmpty(value)) { if (p.SetDefaultValue(value)) { // } else { //a const must have a valid default value Debug.Check(!bConst); } } return(p); }
private static Property create(bool bParVar, bool bConst, string typeName, string variableName, string instanceName, string valueStr) { bool bValidName = !string.IsNullOrEmpty(variableName); if (bValidName) { if (!bParVar) { Property p = Agent.CreateProperty(typeName, variableName, valueStr); if (bValidName && p != null && !bConst) { p.SetVariableName(variableName); p.SetInstanceNameString(instanceName); } return p; } } var bAgentPtr = IsAgentPtr (typeName, valueStr); Property pProperty = new Property(null, bConst); object v = null; if (!bAgentPtr) { bool bArrayType = false; //array type if (typeName.StartsWith("vector<")) { bArrayType = true; } Type type = null; if (bArrayType) { int bracket0 = typeName.IndexOf('<'); int bracket1 = typeName.IndexOf('>'); int len = bracket1 - bracket0 - 1; string elementType = typeName.Substring(bracket0 + 1, len); type = GetTypeFromName(elementType); } else { type = GetTypeFromName(typeName); } v = StringUtils.FromString(type, valueStr, bArrayType); } else { v = null; } pProperty.SetDefaultValue(v); if (bValidName && pProperty != null && !bConst) { pProperty.SetVariableName(variableName); } return pProperty; }
public static Property Create(string value, CMemberBase pMemberBase, bool bConst) { Property p = new Property(pMemberBase, bConst); //a const must have default value Debug.Check(!bConst || !string.IsNullOrEmpty(value)); if (!string.IsNullOrEmpty(value)) { if (p.SetDefaultValue(value)) { // } else { //a const must have a valid default value Debug.Check(!bConst); } } return p; }
private static Property create(bool bParVar, bool bConst, string typeName, string variableName, string instanceName, string valueStr) { bool bValidName = !string.IsNullOrEmpty(variableName); if (bValidName) { if (!bParVar) { Property p = Agent.CreateProperty(typeName, variableName, valueStr); if (bValidName && p != null && !bConst) { p.SetVariableName(variableName); p.SetInstanceNameString(instanceName); } return(p); } } var bAgentPtr = IsAgentPtr(typeName, valueStr); Property pProperty = new Property(null, bConst); object v = null; if (!bAgentPtr) { bool bArrayType = false; //array type if (typeName.StartsWith("vector<")) { bArrayType = true; } Type type = null; if (bArrayType) { int bracket0 = typeName.IndexOf('<'); int bracket1 = typeName.IndexOf('>'); int len = bracket1 - bracket0 - 1; string elementType = typeName.Substring(bracket0 + 1, len); type = GetTypeFromName(elementType); } else { type = GetTypeFromName(typeName); } v = StringUtils.FromString(type, valueStr, bArrayType); } else { v = null; } pProperty.SetDefaultValue(v); if (bValidName && pProperty != null && !bConst) { pProperty.SetVariableName(variableName); } return(pProperty); }
///create instance property, ///create class scope static property public static Property Create(string typeName, string variableName, string value, bool bStatic, bool bConst) { if (!bConst) { string instanceName = null; string pPropertyName = null; bool bParVar = Utils.IsParVar(variableName); if (bParVar) { pPropertyName = string.Format("{0}::{1}", typeName, variableName); } else { pPropertyName = ParseInstanceNameProperty(variableName, ref instanceName); } bool bFound = false; if (!string.IsNullOrEmpty(pPropertyName)) { bFound = ms_properties.ContainsKey(pPropertyName); } if (!bFound) { Property pProperty = Property.create(bParVar, bConst, typeName, pPropertyName, instanceName, value); if (!string.IsNullOrEmpty(pPropertyName)) { Debug.Check(pProperty != null); ms_properties[pPropertyName] = pProperty; } Property pO = pProperty.clone(); return(pO); } Property p = ms_properties[pPropertyName]; Property pO0 = p.clone(); if (!string.IsNullOrEmpty(value)) { bool bAgentPtr = IsAgentPtr(typeName, value); if (!bAgentPtr) { pO0.SetDefaultValue(value); } } return(pO0); } else { //const CMemberBase pMember = null; bool bValidName = !string.IsNullOrEmpty(variableName); string instanceName = null; string pPropertyName = variableName; if (bValidName) { pPropertyName = ParseInstanceNameProperty(variableName, ref instanceName); pMember = Agent.FindMemberBase(pPropertyName); } if (pMember != null) { Property pProperty = pMember.CreateProperty(value, true); return(pProperty); } else { //CMethodBase pMethod = null; //if (bValidName) //{ // pMethod = Agent.FindMethodBase(pPropertyName); //} //if (pMethod != null) //{ // Property pProperty = pMethod.CreateProperty(value, true); // return pProperty; //} bool bParVar = bValidName && Utils.IsParVar(variableName); Property pProperty1 = Property.create(bParVar, bConst, typeName, pPropertyName, instanceName, value); return(pProperty1); } } //return 0; }