public MetaPropertyDialog(bool canBeEdited, AgentType agent, CustomizedStruct customizedStruct, PropertyDef prop, bool canBePar) { InitializeComponent(); this.Owner = MainWindow.Instance; this.metaPropertyPanel.Initialize(canBeEdited, agent, customizedStruct, prop, canBePar); }
public static string GetGenerateAgentName(Behaviac.Design.PropertyDef property, string var, string caller) { string agentName = "pAgent"; if (property.Owner != Behaviac.Design.VariableDef.kSelf) { agentName = string.Format("pAgent_{0}", string.IsNullOrEmpty(var) ? caller : var); agentName = agentName.Replace(".", "_"); } return(agentName); }
public static string GetProperty(DefaultObject defaultObj, Behaviac.Design.PropertyDef property, MethodDef.Param arrayIndexElement, StringWriter stream, string indent, string var, string caller) { string agentName = GetGenerateAgentName(property, var, caller); if (property.Owner != Behaviac.Design.VariableDef.kSelf) { string instanceName = property.Owner.Replace("::", "."); bool isGlobal = Plugin.IsInstanceName(instanceName, null); PropertyDef ownerProperty = null; if (!isGlobal) { Debug.Check(defaultObj != null && defaultObj.Behavior != null && defaultObj.Behavior.AgentType != null); if (defaultObj != null && defaultObj.Behavior != null) { ownerProperty = defaultObj.Behavior.AgentType.GetPropertyByName(instanceName); } } if (isGlobal || ownerProperty == null || ownerProperty.IsCustomized || ownerProperty.IsPar) // global or customized instance { stream.WriteLine("{0}behaviac.Agent {1} = behaviac.Utils.GetParentAgent(pAgent, \"{2}\");", indent, agentName, instanceName); } else // member instance { string prop = ""; if (ownerProperty.IsPublic) { string className = ownerProperty.ClassName.Replace("::", "."); if (ownerProperty.IsStatic) { prop = string.Format("{0}.{1}", className, instanceName); } else { prop = string.Format("(({0})pAgent).{1}", className, instanceName); } } else { string nativeType = DataCsExporter.GetGeneratedNativeType(ownerProperty.NativeType); prop = string.Format("({0})AgentMetaVisitor.GetProperty(pAgent, \"{1}\")", nativeType, instanceName); } stream.WriteLine("{0}behaviac.Agent {1} = {2};", indent, agentName, prop); } stream.WriteLine("{0}Debug.Check(!System.Object.ReferenceEquals({1}, null) || Utils.IsStaticClass(\"{2}\"));", indent, agentName, instanceName); } return(getProperty(property, arrayIndexElement, agentName, stream, indent)); }
public static string GetPropertyBasicName(Behaviac.Design.PropertyDef property, MethodDef.Param arrayIndexElement) { string propName = property.BasicName; if (property != null && property.IsArrayElement && arrayIndexElement != null) { propName = propName.Replace("[]", ""); } return(propName); }
public override bool ResetMembers(bool check, AgentType agentType, bool clear, MethodDef method = null, PropertyDef property = null) { bool bReset = false; if (this._frames != null) { bReset |= this._frames.ResetMembers(check, agentType, clear, method, property); } bReset |= base.ResetMembers(check, agentType, clear, method, property); return bReset; }
public static string GetProperty(Behaviac.Design.PropertyDef property, MethodDef.Param arrayIndexElement, StreamWriter stream, string indent, string var, string caller) { string agentName = GetGenerateAgentName(property, var, caller); if (property.Owner != Behaviac.Design.VariableDef.kSelf) { stream.WriteLine("{0}Agent* {1} = Agent::GetInstance(pAgent, \"{2}\");", indent, agentName, property.Owner); stream.WriteLine("{0}BEHAVIAC_ASSERT({1});", indent, agentName); } string prop = getProperty(property, arrayIndexElement, agentName, stream, indent); return(prop); }
public static void PostGenerateCode(Behaviac.Design.PropertyDef property, MethodDef.Param arrayIndexElement, StreamWriter stream, string indent, string typename, string var, string caller) { if (string.IsNullOrEmpty(typename)) { typename = property.NativeType; } typename = DataCsExporter.GetGeneratedNativeType(typename); string propBasicName = property.BasicName.Replace("[]", ""); uint id = Behaviac.Design.CRC32.CalcCRC(propBasicName); stream.WriteLine("{0}Debug.Check(behaviac.Utils.MakeVariableId(\"{1}\") == {2}u);", indent, propBasicName, id); stream.WriteLine("{0}pAgent.SetVariable<{1}>(\"{2}\", {3}u, ({1}){4});", indent, typename, property.Name, id, var); }
public static string GetProperty(Behaviac.Design.PropertyDef property, MethodDef.Param arrayIndexElement, StreamWriter stream, string indent, string var, string caller) { string agentName = GetGenerateAgentName(property, var, caller); if (property.Owner != Behaviac.Design.VariableDef.kSelf) { stream.WriteLine("{0}behaviac.Agent {1} = behaviac.Agent.GetInstance(\"{2}\", pAgent.GetContextId());", indent, agentName, property.Owner.Replace("::", ".")); stream.WriteLine("{0}Debug.Check({1} != null);", indent, agentName); } string prop = getProperty(property, arrayIndexElement, agentName, stream, indent); return(prop); }
public void Initialize(bool canBeEdit, AgentType agent, CustomizedStruct customizedStruct, PropertyDef prop, bool canBePar) { Debug.Check(agent != null || customizedStruct != null); _initialized = false; _isModified = false; _isNew = (prop == null); _agent = agent; _customizedStruct = customizedStruct; _originalProperty = prop; setTypes(); if (_isNew) { this.Text = canBeEdit ? Resources.AddProperty : Resources.ViewProperty; if (customizedStruct == null) _property = new PropertyDef(agent, null, agent.AgentTypeName, "", "", ""); else _property = new PropertyDef(null, null, customizedStruct.Name, "", "", ""); } else { this.Text = canBeEdit ? Resources.EditProperty : Resources.ViewProperty; resetProperty(prop, prop.IsPar); } this.isStaticCheckBox.Visible = (agent != null); this.isPublicCheckBox.Visible = !canBeEdit && (agent != null); this.isConstcheckBox.Visible = (agent != null); this.customizedCheckBox.Visible = !canBeEdit && !_property.IsInherited; this.isLocalCheckBox.Checked = customizedStruct == null && _property.IsPar; this.isLocalCheckBox.Visible = canBePar && customizedStruct == null && !_property.IsMember; this.nameTextBox.Enabled = canBeEdit; this.arrayCheckBox.Enabled = canBeEdit || _property.IsChangeableType; this.typeComboBox.Enabled = canBeEdit || _property.IsChangeableType; this.isStaticCheckBox.Enabled = canBeEdit; this.isConstcheckBox.Enabled = canBeEdit; this.dispTextBox.Enabled = canBeEdit; this.descTextBox.Enabled = canBeEdit; _initialized = true; }
public static void PostGenerateCode(Behaviac.Design.PropertyDef property, StreamWriter stream, string indent, string typename, string var, string caller) { string propBasicName = property.BasicName.Replace("[]", ""); uint id = Behaviac.Design.CRC32.CalcCRC(propBasicName); bool isListType = (typename == "IList"); bool isString = (typename == "char*" || typename == "const char*"); if (isListType) { var = string.Format("*{0}.vector_", var); } else if (isString) { var = string.Format("behaviac::string({0})", var); } stream.WriteLine("{0}BEHAVIAC_ASSERT(behaviac::MakeVariableId(\"{1}\") == {2}u);", indent, propBasicName, id); stream.WriteLine("{0}pAgent->SetVariable(\"{1}\", {2}, {3}u);", indent, propBasicName, var, id); }
public static void PostGenerateCode(Behaviac.Design.PropertyDef property, MethodDef.Param arrayIndexElement, StreamWriter stream, string indent, string typename, string var, string caller, string setValue = null) { if (property.IsPar || property.IsCustomized) { ParInfoCsExporter.PostGenerateCode(property, arrayIndexElement, stream, indent, typename, var, caller); return; } if (!property.IsReadonly) { string agentName = GetGenerateAgentName(property, var, caller); string prop = setValue; if (property.Owner != Behaviac.Design.VariableDef.kSelf) { stream.WriteLine("{0}behaviac.Agent {1} = behaviac.Agent.GetInstance(\"{2}\", pAgent.GetContextId());", indent, agentName, property.Owner.Replace("::", ".")); stream.WriteLine("{0}Debug.Check({1} != null);", indent, agentName); } string propBasicName = property.BasicName.Replace("[]", ""); if (setValue != null) { stream.WriteLine("{0}AgentExtra_Generated.SetProperty({1}, \"{2}\", {3});", indent, agentName, propBasicName, prop); } else { prop = getProperty(property, arrayIndexElement, agentName, stream, indent); } uint id = Behaviac.Design.CRC32.CalcCRC(propBasicName); stream.WriteLine("{0}Debug.Check(behaviac.Utils.MakeVariableId(\"{1}\") == {2}u);", indent, propBasicName, id); if (string.IsNullOrEmpty(typename)) { typename = property.NativeType; } typename = DataCsExporter.GetGeneratedNativeType(typename); stream.WriteLine("{0}{1}.SetVariable<{2}>(\"{3}\", {4}, {5}u);", indent, agentName, typename, property.BasicName, prop, id); } }
public static string GetProperty(Behaviac.Design.PropertyDef property, MethodDef.Param arrayIndexElement, StreamWriter stream, string indent) { string retStr = string.Empty; if (property != null) { string typename = DataCppExporter.GetGeneratedNativeType(property.NativeType); if (property.IsArrayElement && !typename.StartsWith("behaviac::vector<")) { typename = string.Format("behaviac::vector<{0} >", typename); } string propBasicName = property.BasicName.Replace("[]", ""); uint id = Behaviac.Design.CRC32.CalcCRC(propBasicName); retStr = string.Format("({0})pAgent->GetVariable<{0} >({1}u)", typename, id); } return(retStr); }
public static string GetProperty(Behaviac.Design.PropertyDef property, MethodDef.Param arrayIndexElement, StreamWriter stream, string indent) { string retStr = string.Empty; if (property != null) { string typename = DataCsExporter.GetGeneratedNativeType(property.NativeType); if (property.IsArrayElement && !typename.StartsWith("List<")) { typename = string.Format("List<{0}>", typename); } string propBasicName = property.BasicName.Replace("[]", ""); uint id = Behaviac.Design.CRC32.CalcCRC(propBasicName); stream.WriteLine("{0}Debug.Check(behaviac.Utils.MakeVariableId(\"{1}\") == {2}u);", indent, propBasicName, id); retStr = string.Format("pAgent.GetVariable<{0}>({1}u)", typename, id); } return(retStr); }
public static string GenerateCode(DefaultObject defaultObj, Behaviac.Design.PropertyDef property, MethodDef.Param arrayIndexElement, bool isRefParam, StreamWriter stream, string indent, string typename, string var, string caller) { if (property.IsPar || property.IsCustomized) { return(ParInfoCppExporter.GenerateCode(property, isRefParam, stream, indent, typename, var, caller)); } string prop = GetProperty(defaultObj, property, arrayIndexElement, stream, indent, var, caller); if (!string.IsNullOrEmpty(var)) { if (string.IsNullOrEmpty(typename)) { stream.WriteLine("{0}{1} = {2};", indent, var, prop); } else { stream.WriteLine("{0}{1} {2} = {3};", indent, DataCppExporter.GetGeneratedNativeType(property.NativeType), var, prop); } } return(prop); }
public static string GenerateCode(Behaviac.Design.PropertyDef property, MethodDef.Param arrayIndexElement, bool isRefParam, StreamWriter stream, string indent, string typename, string var, string caller, string setValue = null) { if (property.IsPar || property.IsCustomized) { return(ParInfoCsExporter.GenerateCode(property, isRefParam, stream, indent, typename, var, caller)); } string agentName = GetGenerateAgentName(property, var, caller); string prop = GetProperty(property, arrayIndexElement, stream, indent, var, caller); if (!property.IsReadonly) { if (setValue == null) { if (!string.IsNullOrEmpty(var)) { if (string.IsNullOrEmpty(typename)) { stream.WriteLine("{0}{1} = {2};", indent, var, prop); } else { string nativeType = DataCsExporter.GetPropertyNativeType(property, arrayIndexElement); stream.WriteLine("{0}{1} {2} = {3};", indent, nativeType, var, prop); } } } else { string propBasicName = property.BasicName.Replace("[]", ""); stream.WriteLine("{0}AgentExtra_Generated.SetProperty({1}, \"{2}\", {3});", indent, agentName, propBasicName, setValue); } } return(prop); }
public static string GetProperty(DefaultObject defaultObj, Behaviac.Design.PropertyDef property, MethodDef.Param arrayIndexElement, StringWriter stream, string indent, string var, string caller) { string agentName = GetGenerateAgentName(property, var, caller); if (property.Owner != Behaviac.Design.VariableDef.kSelf) { bool isGlobal = Plugin.IsInstanceName(property.Owner, null); PropertyDef ownerProperty = null; if (!isGlobal) { Debug.Check(defaultObj != null && defaultObj.Behavior != null && defaultObj.Behavior.AgentType != null); if (defaultObj != null && defaultObj.Behavior != null) { ownerProperty = defaultObj.Behavior.AgentType.GetPropertyByName(property.Owner); } } if (isGlobal || ownerProperty == null || ownerProperty.IsCustomized || ownerProperty.IsPar) // global or customized instance { stream.WriteLine("{0}Agent* {1} = Agent::GetInstance(pAgent, \"{2}\");", indent, agentName, property.Owner); } else // member instance { string propName = ownerProperty.Name.Replace("::", "_"); string nativeType = DataCppExporter.GetGeneratedNativeType(ownerProperty.Type); string prop = string.Format("(({0}*)pAgent)->_Get_Property_<{1}PROPERTY_TYPE_{2}, {3} >()", ownerProperty.ClassName, getNamespace(ownerProperty.ClassName), propName, nativeType); stream.WriteLine("{0}Agent* {1} = {2};", indent, agentName, prop); } stream.WriteLine("{0}BEHAVIAC_ASSERT({1});", indent, agentName); } return(getProperty(property, arrayIndexElement, agentName, stream, indent)); }
public bool SwapTwoProperties(PropertyDef property1, PropertyDef property2) { if (property1 != null && (property1.IsCustomized || property1.IsPar) && property2 != null && (property2.IsCustomized || property2.IsPar) && (property1.IsCustomized == property2.IsCustomized || property1.IsPar == property2.IsPar)) { int index1 = getPropertyIndex(property1); int index2 = getPropertyIndex(property2); if (index1 >= 0 && index2 >= 0) { this._propertyList[index1] = property2; this._propertyList[index2] = property1; return true; } } return false; }
private int getPropertyIndex(PropertyDef property) { if (property != null) { for (int i = 0; i < this._propertyList.Count; ++i) { if (property == this._propertyList[i]) { return i; } } } return -1; }
private string getPrefixString(PropertyDef p) { if (p != null) { if (p.IsChangeableType) return (p.Type == typeof(object)) ? Empty_Type_Str : Changeable_Type_Str; if (p.IsPar) return Par_Str; if (!p.IsMember) return Customized_Str; } return Member_Str; }
public ParInfo(PropertyDef other) { this.CopyFrom(other); }
public bool ResetMembers(bool check, AgentType agentType, bool clear, PropertyDef property) { if (property != null && this._property != null && (property.OldName == this._property.Name || !property.IsArrayElement && this._property.IsArrayElement && (property.OldName + "[]") == this._property.Name)) { if (!check) { if (clear || this._property.ShouldBeCleared(agentType)) { this._property = null; } else { bool isArrayElement = this._property.IsArrayElement; this._property.CopyFrom(property); if (isArrayElement) { this._property.SetArrayElement(property); } } } return true; } return false; }
public static string GetGeneratedPropertyDefaultValue(PropertyDef prop, string typename) { return((prop != null) ? GetGeneratedDefaultValue(prop.Type, typename, prop.DefaultValue) : null); }
public void SetArrayElement(PropertyDef arrayProperty) { Debug.Check(arrayProperty != null && arrayProperty.Type != null && Plugin.IsArrayType(arrayProperty.Type)); this.IsArrayElement = true; this.IsAddedAutomatically = true; this.Type = arrayProperty.Type.GetGenericArguments()[0]; this.Name = arrayProperty.Name + "[]"; this.DisplayName = arrayProperty.DisplayName + "[]"; this.Description = this.DisplayName; }
public void Initialize(bool canBeEdit, AgentType agent, CustomizedStruct customizedStruct, PropertyDef prop, bool canBePar) { Debug.Check(agent != null || customizedStruct != null); _initialized = false; _isModified = false; _isNew = (prop == null); _agent = agent; _customizedStruct = customizedStruct; _originalProperty = prop; setTypes(); if (_isNew) { this.Text = canBeEdit ? Resources.AddProperty : Resources.ViewProperty; if (customizedStruct == null) { _property = new PropertyDef(agent, null, agent.AgentTypeName, "", "", ""); } else { _property = new PropertyDef(null, null, customizedStruct.Name, "", "", ""); } } else { this.Text = canBeEdit ? Resources.EditProperty : Resources.ViewProperty; resetProperty(prop, prop.IsPar); } this.isStaticCheckBox.Visible = (agent != null); this.isPublicCheckBox.Visible = !canBeEdit && (agent != null); this.isConstcheckBox.Visible = (agent != null); this.customizedCheckBox.Visible = !canBeEdit && !_property.IsInherited; this.isLocalCheckBox.Checked = customizedStruct == null && _property.IsPar; this.isLocalCheckBox.Visible = canBePar && customizedStruct == null && !_property.IsMember; this.nameTextBox.Enabled = canBeEdit; this.arrayCheckBox.Enabled = canBeEdit; this.typeComboBox.Enabled = canBeEdit; this.isStaticCheckBox.Enabled = canBeEdit; this.isConstcheckBox.Enabled = canBeEdit; this.dispTextBox.Enabled = canBeEdit; this.descTextBox.Enabled = canBeEdit; _initialized = true; }
public static string GenerateCode(Behaviac.Design.PropertyDef property, bool isRefParam, StreamWriter stream, string indent, string typename, string var, string caller) { bool shouldDefineType = true; if (string.IsNullOrEmpty(typename)) { shouldDefineType = false; typename = property.NativeType; } else if (typename == "System::Object") { typename = property.NativeType; } if (!typename.EndsWith("*") && Plugin.IsRefType(property.Type)) { typename += "*"; } bool isListType = (typename == "IList"); bool isString = (typename == "char*" || typename == "const char*"); if (isListType) { typename = property.NativeType; } typename = DataCppExporter.GetGeneratedNativeType(typename); if (property.IsArrayElement && !typename.StartsWith("vector<") && !typename.StartsWith("behaviac::vector<")) { typename = string.Format("vector<{0} >", typename); } string varType = typename; string propBasicName = property.BasicName.Replace("[]", ""); uint id = Behaviac.Design.CRC32.CalcCRC(propBasicName); string retStr = string.Format("({0}&)pAgent->GetVariable<{1} >({2}u)", typename, varType, id); if (isString) { retStr = string.Format("(char*)((behaviac::string&)pAgent->GetVariable<behaviac::string>({0}u)).c_str()", id); } if (!string.IsNullOrEmpty(var)) { stream.WriteLine("{0}BEHAVIAC_ASSERT(behaviac::MakeVariableId(\"{1}\") == {2}u);", indent, propBasicName, id); if (shouldDefineType || isRefParam) { if (isListType) { typename = string.Format("TList<{0} >", property.NativeType); retStr = string.Format("&({0})", retStr); } else if (!isString) { typename = typename + "&"; } stream.WriteLine("{0}{1} {2} = {3};", indent, typename, var, retStr); } else { stream.WriteLine("{0}{1} = {2};", indent, var, retStr); } } return(retStr); }
private static void LoadCustomMembers(List<Nodes.Node.ErrorCheck> result, XmlNode rootNode) { if (rootNode == null) { return; } // Set the default base agent. if (Plugin.AgentTypes.Count == 0) { AgentType agent = new AgentType(typeof(Agent), "Agent", false, "Agent", ""); Plugin.AgentTypes.Add(agent); } foreach(XmlNode xmlNode in rootNode.ChildNodes) { if (xmlNode.Name == "agent") { string agentName = GetAttribute(xmlNode, "type"); string agentBase = GetAttribute(xmlNode, "base"); int baseIndex = -1; for (int i = 0; i < Plugin.AgentTypes.Count; ++i) { if (Plugin.AgentTypes[i].AgentTypeName == agentBase) { baseIndex = i; break; } } string agentDisp = GetAttribute(xmlNode, "disp"); string agentDesc = GetAttribute(xmlNode, "desc"); if (string.IsNullOrEmpty(agentDisp)) { agentDisp = agentName; } AgentType agent = Plugin.GetAgentType(agentName); if (agent == null) { agent = new AgentType(agentName, (baseIndex > -1) ? Plugin.AgentTypes[baseIndex] : null, agentDisp, agentDesc); Plugin.AgentTypes.Add(agent); } foreach(XmlNode bbNode in xmlNode) { if (bbNode.Name == "properties") { foreach(XmlNode propNode in bbNode) { if (propNode.Name == "property") { string propName = GetAttribute(propNode, "name"); string isStatic = GetAttribute(propNode, "static"); bool bStatic = false; if (!string.IsNullOrEmpty(isStatic) && isStatic == "true") { bStatic = true; } string isPublic = GetAttribute(propNode, "public"); bool bPublic = false; if (string.IsNullOrEmpty(isPublic) || isPublic == "true") { bPublic = true; } string isReadonly = GetAttribute(propNode, "readonly"); bool bReadonly = false; if (!string.IsNullOrEmpty(isReadonly) && isReadonly == "true") { bReadonly = true; } string propType = GetAttribute(propNode, "type"); Type type = Plugin.GetTypeFromName(propType); string classname = GetAttribute(propNode, "classname"); if (string.IsNullOrEmpty(classname)) { classname = agent.AgentTypeName; } string propDisp = GetAttribute(propNode, "disp"); if (string.IsNullOrEmpty(propDisp)) { propDisp = propName; } string propDesc = GetAttribute(propNode, "desc"); PropertyDef prop = new PropertyDef(agent, type, classname, propName, propDisp, propDesc); prop.IsStatic = bStatic; prop.IsPublic = bPublic; prop.IsReadonly = bReadonly; string defaultValue = GetAttribute(propNode, "defaultvalue"); if (!string.IsNullOrEmpty(defaultValue)) { prop.Variable = new VariableDef(null); Plugin.InvokeTypeParser(result, type, defaultValue, (object value) => prop.Variable.Value = value, null); } agent.AddProperty(prop); } } } else if (bbNode.Name == "methods") { foreach(XmlNode methodNode in bbNode) { if (methodNode.Name == "method") { string methodName = GetAttribute(methodNode, "name"); Type returnType = Plugin.GetTypeFromName(GetAttribute(methodNode, "returntype")); string isStatic = GetAttribute(methodNode, "static"); bool bStatic = false; if (!string.IsNullOrEmpty(isStatic) && isStatic == "true") { bStatic = true; } string isPublic = GetAttribute(methodNode, "public"); bool bPublic = false; if (string.IsNullOrEmpty(isPublic) || isPublic == "true") { bPublic = true; } string classname = GetAttribute(methodNode, "classname"); if (string.IsNullOrEmpty(classname)) { classname = agent.AgentTypeName; } string methodDisp = GetAttribute(methodNode, "disp"); if (string.IsNullOrEmpty(methodDisp)) { methodDisp = methodName; } string methodDesc = GetAttribute(methodNode, "desc"); bool istask = (GetAttribute(methodNode, "istask") == "true"); //bool isevent = (GetAttribute(methodNode, "isevent") == "true"); MemberType memberType = MemberType.Method; if (istask) { memberType = MemberType.Task; } methodName = string.Format("{0}::{1}", agent.AgentTypeName, methodName); MethodDef method = new MethodDef(agent, memberType, classname, methodName, methodDisp, methodDesc, "", returnType); method.IsStatic = bStatic; method.IsPublic = bPublic; agent.AddMethod(method); foreach(XmlNode paramNode in methodNode) { string paramName = GetAttribute(paramNode, "name"); Type paramType = Plugin.GetTypeFromName(GetAttribute(paramNode, "type")); bool isOut = (GetAttribute(paramNode, "isout") == "true"); bool isRef = (GetAttribute(paramNode, "isref") == "true"); string nativeType = Plugin.GetNativeTypeName(paramType); string paramDisp = GetAttribute(paramNode, "disp"); if (string.IsNullOrEmpty(paramDisp)) { paramDisp = paramName; } string paramDesc = GetAttribute(paramNode, "desc"); MethodDef.Param param = new MethodDef.Param(paramName, paramType, nativeType, paramDisp, paramDesc); param.IsOut = isOut; param.IsRef = isRef; method.Params.Add(param); } } } } } } } }
public static string GetPropertyNativeType(Behaviac.Design.PropertyDef property, MethodDef.Param arrayIndexElement) { string nativeType = DataCppExporter.GetGeneratedNativeType(property.NativeType); return(nativeType); }
public static string GetGeneratedPropertyDefaultValue(PropertyDef prop, string typename) { string value = ""; if (prop != null) { value = prop.DefaultValue; if (Plugin.IsStringType(prop.Type)) { value = "\"" + value + "\""; } else if (Plugin.IsBooleanType(prop.Type)) { value = value.ToLowerInvariant(); } else if (Plugin.IsEnumType(prop.Type)) { value = string.Format("{0}.{1}", typename, value); } else if (Plugin.IsArrayType(prop.Type)) { value = ""; } else if (Plugin.IsCustomClassType(prop.Type)) { value = ""; } } return value; }
public static string GenerateCode(Behaviac.Design.PropertyDef property, bool isRefParam, StreamWriter stream, string indent, string typename, string var, string caller) { bool shouldDefineType = true; if (string.IsNullOrEmpty(typename)) { shouldDefineType = false; typename = property.NativeType; } typename = DataCsExporter.GetGeneratedNativeType(typename); if (property.IsArrayElement && !typename.StartsWith("List<")) { typename = string.Format("List<{0}>", typename); } string propBasicName = property.BasicName.Replace("[]", ""); uint id = Behaviac.Design.CRC32.CalcCRC(propBasicName); string retStr = string.Format("pAgent.GetVariable<{0}>({1}u)", typename, id); if (!string.IsNullOrEmpty(var)) { stream.WriteLine("{0}Debug.Check(behaviac.Utils.MakeVariableId(\"{1}\") == {2}u);", indent, propBasicName, id); //if (isRefParam) //{ // if (shouldDefineType) // stream.WriteLine("{0}{1} {2};", indent, typename, var); // Type type = property.Type; // if (type != null && (type.IsValueType || Plugin.IsEnumType(type) || Plugin.IsStringType(type))) // { // stream.WriteLine("{0}object var_{1} = pAgent.GetVariableObject({2}u);", indent, var, id); // stream.WriteLine("{0}if (var_{1} != null)", indent, var); // stream.WriteLine("{0}\t{1} = ({2})var_{1};", indent, var, typename); // stream.WriteLine("{0}else", indent, var); // if (!Plugin.IsArrayType(property.Type) && !Plugin.IsCustomClassType(property.Type)) // { // object defaultObj = Plugin.DefaultValue(property.Type); // Debug.Check(defaultObj != null); // string objStr = DesignerPropertyUtility.RetrieveExportValue(defaultObj); // if (defaultObj is char) // { // objStr = "(char)0"; // } // else if (Plugin.IsEnumType(defaultObj.GetType())) // { // objStr = string.Format("{0}.{1}", typename, objStr); // } // stream.WriteLine("{0}\t{1} = {2};", indent, var, objStr); // } // else // { // stream.WriteLine("{0}\t{1} = new {2}();", indent, var, DataCsExporter.GetGeneratedNativeType(property.Type)); // } // } // else // { // stream.WriteLine("{0}{1} = ({2})pAgent.GetVariableObject({3}u);", indent, var, typename, id); // } //} //else { if (shouldDefineType) { stream.WriteLine("{0}{1} {2} = {3};", indent, typename, var, retStr); } else { stream.WriteLine("{0}{1} = {2};", indent, var, retStr); } } } return(retStr); }
public VariableDef(PropertyDef property, string valueType) { SetProperty(property, valueType); }
public override bool ResetMembers(bool check, AgentType agentType, bool clear, MethodDef method = null, PropertyDef property = null) { bool bReset = false; if (this._task != null && method != null && this._task.Name == method.OldName) { if (method != null && this._task.Name == method.OldName && (clear || this._task.ShouldBeCleared(agentType))) { bReset = true; if (!check) { this._task = null; } } else { bReset |= this._task.ResetMembers(check, agentType, clear, method, property); } } bReset |= base.ResetMembers(check, agentType, clear, method, property); return bReset; }
private void resetProperty(PropertyDef prop, bool isPar) { if (isPar) _property = new ParInfo(prop); else _property = new PropertyDef(prop); _property.OldName = prop.Name; _isArray = Plugin.IsArrayType(_property.Type); Type type = _isArray ? _property.Type.GetGenericArguments()[0] : _property.Type; this.nameTextBox.Text = _property.BasicName; this.arrayCheckBox.Checked = _isArray; this.typeComboBox.Text = Plugin.GetMemberValueTypeName(type); this.isStaticCheckBox.Checked = _property.IsStatic; this.isPublicCheckBox.Checked = _property.IsPublic; this.isConstcheckBox.Checked = _property.IsReadonly; this.customizedCheckBox.Checked = _property.IsExportedButAlsoCustomized; this.dispTextBox.Text = _property.DisplayName; this.descTextBox.Text = _property.BasicDescription; resetType(type, false); }
private static void LoadCustomTypes(XmlNode rootNode) { if (rootNode == null) { return; } CustomizedTypeManager.Instance.Enums.Clear(); CustomizedTypeManager.Instance.Structs.Clear(); foreach(XmlNode xmlNode in rootNode.ChildNodes) { if (xmlNode.Name == "enumtype") { string enumName = GetAttribute(xmlNode, "Type"); string[] enumNames = enumName.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); enumName = enumNames[enumNames.Length - 1]; string displayName = GetAttribute(xmlNode, "DisplayName"); string desc = GetAttribute(xmlNode, "Desc"); CustomizedEnum customizedEnum = new CustomizedEnum(null); customizedEnum.Name = enumName; customizedEnum.DisplayName = displayName; customizedEnum.Description = desc; foreach(XmlNode memberNode in xmlNode.ChildNodes) { if (memberNode.Name == "enum") { string memberName = GetAttribute(memberNode, "Value"); string[] memberNames = memberName.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); memberName = memberNames[memberNames.Length - 1]; string memberDisplayName = GetAttribute(memberNode, "DisplayName"); string memberDesc = GetAttribute(memberNode, "Desc"); string memberValue = GetAttribute(memberNode, "MemberValue"); CustomizedEnum.CustomizedEnumMember enumMember = new CustomizedEnum.CustomizedEnumMember(null); enumMember.Name = memberName; enumMember.DisplayName = memberDisplayName; enumMember.Description = memberDesc; try { enumMember.Value = int.Parse(memberValue); } catch { enumMember.Value = -1; } customizedEnum.Members.Add(enumMember); } } CustomizedTypeManager.Instance.Enums.Add(customizedEnum); } else if (xmlNode.Name == "struct") { string structName = GetAttribute(xmlNode, "Type"); string[] structNames = structName.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); structName = structNames[structNames.Length - 1]; string displayName = GetAttribute(xmlNode, "DisplayName"); string desc = GetAttribute(xmlNode, "Desc"); CustomizedStruct customizedStruct = new CustomizedStruct(null); customizedStruct.Name = structName; customizedStruct.DisplayName = displayName; customizedStruct.Description = desc; foreach(XmlNode memberNode in xmlNode.ChildNodes) { if (memberNode.Name == "Member") { string memberName = GetAttribute(memberNode, "Name"); string[] memberNames = memberName.Split(new char[] { ':' }, StringSplitOptions.RemoveEmptyEntries); memberName = memberNames[memberNames.Length - 1]; string memberType = GetAttribute(memberNode, "Type"); Type type = Plugin.GetTypeFromName(memberType); string memberDisplayName = GetAttribute(memberNode, "DisplayName"); string memberDesc = GetAttribute(memberNode, "Desc"); PropertyDef structProp = new PropertyDef(null, type, structName, memberName, memberDisplayName, memberDesc); customizedStruct.Properties.Add(structProp); } } CustomizedTypeManager.Instance.Structs.Add(customizedStruct); } } }
private void addRowControl(PropertyDef property) { this.tableLayoutPanel.RowCount++; this.tableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); int rowIndex = _rowControls.Count + 1; RowControl rowControl = new RowControl(); _rowControls.Add(rowControl); rowControl.Name = property.BasicName; rowControl.NameLabel = new System.Windows.Forms.Label(); rowControl.NameLabel.Dock = System.Windows.Forms.DockStyle.Fill; rowControl.NameLabel.Margin = new System.Windows.Forms.Padding(0); rowControl.NameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; rowControl.NameLabel.Text = property.DisplayName; this.tableLayoutPanel.Controls.Add(rowControl.NameLabel, 0, rowIndex); rowControl.TypeLabel = new System.Windows.Forms.Label(); rowControl.TypeLabel.Dock = System.Windows.Forms.DockStyle.Fill; rowControl.TypeLabel.Margin = new System.Windows.Forms.Padding(0); rowControl.TypeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; rowControl.TypeLabel.Text = Plugin.GetNativeTypeName(property.Type); this.tableLayoutPanel.Controls.Add(rowControl.TypeLabel, 1, rowIndex); rowControl.ValueEditor = createPropertyEditor(property); rowControl.ValueEditor.Dock = System.Windows.Forms.DockStyle.Fill; rowControl.ValueEditor.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel.Controls.Add(rowControl.ValueEditor, 2, rowIndex); }
public PropertyDef(PropertyDef other) { this.CopyFrom(other); }
/// <summary> /// Generate the native code for the given value object. /// </summary> /// <param name="obj">The given object.</param> /// <param name="stream">The file stream for generating the codes.</param> /// <param name="indent">The indent string when generating the line of codes.</param> /// <param name="typename">The native type of the variable.</param> /// <param name="var">The variable for the given object when generating the codes.</param> /// <param name="caller">The caller for the method or the agent.</param> /// <returns>Returns the string generated value.</returns> public static string GenerateCode(object obj, StreamWriter stream, string indent, string typename, string var, string caller) { string retStr = string.Empty; if (obj != null) { Type type = obj.GetType(); if (obj is Behaviac.Design.MethodDef) { Behaviac.Design.MethodDef method = obj as Behaviac.Design.MethodDef; retStr = MethodCppExporter.GenerateCode(method, stream, indent, typename, var, caller); } else if (obj is Behaviac.Design.MethodDef.Param) { Behaviac.Design.MethodDef.Param param = obj as Behaviac.Design.MethodDef.Param; retStr = ParameterCppExporter.GenerateCode(param, stream, indent, typename, var, caller); } else if (obj is Behaviac.Design.ParInfo) { Behaviac.Design.ParInfo par = obj as Behaviac.Design.ParInfo; retStr = ParInfoCppExporter.GenerateCode(par, false, stream, indent, typename, var, caller); } else if (obj is Behaviac.Design.PropertyDef) { Behaviac.Design.PropertyDef property = obj as Behaviac.Design.PropertyDef; retStr = PropertyCppExporter.GenerateCode(property, null, false, stream, indent, typename, var, caller); } else if (obj is Behaviac.Design.VariableDef) { Behaviac.Design.VariableDef variable = obj as Behaviac.Design.VariableDef; retStr = VariableCppExporter.GenerateCode(variable, false, stream, indent, typename, var, caller); } else if (obj is Behaviac.Design.RightValueDef) { Behaviac.Design.RightValueDef rightValue = obj as Behaviac.Design.RightValueDef; retStr = RightValueCppExporter.GenerateCode(rightValue, stream, indent, typename, var, caller); } // Array type else if (Plugin.IsArrayType(type)) { retStr = var; if (!string.IsNullOrEmpty(typename)) { stream.WriteLine("{0}{1} {2};", indent, DataCppExporter.GetBasicGeneratedNativeType(typename), var); } else { typename = DataCppExporter.GetGeneratedNativeType(type); } int startIndex = typename.IndexOf('<'); int endIndex = typename.LastIndexOf('>'); string itemType = typename.Substring(startIndex + 1, endIndex - startIndex - 1); ArrayCppExporter.GenerateCode(obj, stream, indent, itemType, var); } // Struct type else if (Plugin.IsCustomClassType(type)) { retStr = var; if (!string.IsNullOrEmpty(typename)) { if (typename.EndsWith("*")) { stream.WriteLine("{0}{1} {2} = NULL;", indent, DataCppExporter.GetBasicGeneratedNativeType(typename), var); } else { stream.WriteLine("{0}{1} {2};", indent, DataCppExporter.GetBasicGeneratedNativeType(typename), var); } } StructCppExporter.GenerateCode(obj, stream, indent, var, null, ""); } // Other types else { retStr = obj.ToString(); if (Plugin.IsStringType(type)) // string { retStr = string.Format("\"{0}\"", retStr); if (typename.StartsWith("behaviac::wstring")) { retStr = string.Format("StringUtils::MBSToWCS({0})", retStr); } else { retStr = string.Format("(char*)({0})", retStr); } } else if (Plugin.IsBooleanType(type)) // bool { retStr = retStr.ToLowerInvariant(); } else if (Plugin.IsEnumType(type)) // enum { retStr = EnumCppExporter.GeneratedCode(obj); } else if (Plugin.IsFloatType(type)) // float { if (retStr.Contains(".") && !retStr.EndsWith("f") && !retStr.EndsWith("F")) { retStr = retStr + "f"; } } if (!string.IsNullOrEmpty(var)) { if (string.IsNullOrEmpty(typename)) { stream.WriteLine("{0}{1} = {2};", indent, var, retStr); } else { typename = DataCppExporter.GetGeneratedNativeType(typename); stream.WriteLine("{0}{1} {2} = {3};", indent, typename, var, retStr); } } } } return(retStr); }
/// <summary> /// Generate code for the given value object. /// </summary> /// <param name="obj">The given object.</param> /// <param name="stream">The file stream for generating the codes.</param> /// <param name="indent">The indent string when generating the line of codes.</param> /// <param name="typename">The native type of the variable.</param> /// <param name="var">The variable for the given object when generating the codes.</param> /// <param name="caller">The caller for the method or the agent.</param> /// <returns>Returns the string generated value.</returns> public static string GenerateCode(object obj, StreamWriter stream, string indent, string typename, string var, string caller, string setValue = null) { string retStr = string.Empty; if (obj != null) { Type type = obj.GetType(); if (obj is Behaviac.Design.MethodDef) { Behaviac.Design.MethodDef method = obj as Behaviac.Design.MethodDef; retStr = MethodCsExporter.GenerateCode(method, stream, indent, typename, var, caller); } else if (obj is Behaviac.Design.MethodDef.Param) { Behaviac.Design.MethodDef.Param param = obj as Behaviac.Design.MethodDef.Param; retStr = ParameterCsExporter.GenerateCode(param, stream, indent, typename, var, caller); } else if (obj is Behaviac.Design.ParInfo) { Behaviac.Design.ParInfo par = obj as Behaviac.Design.ParInfo; retStr = ParInfoCsExporter.GenerateCode(par, false, stream, indent, typename, var, caller); } else if (obj is Behaviac.Design.PropertyDef) { Behaviac.Design.PropertyDef property = obj as Behaviac.Design.PropertyDef; retStr = PropertyCsExporter.GenerateCode(property, null, false, stream, indent, typename, var, caller, setValue); } else if (obj is Behaviac.Design.VariableDef) { Behaviac.Design.VariableDef variable = obj as Behaviac.Design.VariableDef; retStr = VariableCsExporter.GenerateCode(variable, false, stream, indent, typename, var, caller); } else if (obj is Behaviac.Design.RightValueDef) { Behaviac.Design.RightValueDef rightValue = obj as Behaviac.Design.RightValueDef; retStr = RightValueCsExporter.GenerateCode(rightValue, stream, indent, typename, var, caller); } // Array type else if (Plugin.IsArrayType(type)) { retStr = var; if (!string.IsNullOrEmpty(typename)) { stream.WriteLine("{0}{1} {2};", indent, typename, var); } else { typename = DataCsExporter.GetGeneratedNativeType(type); } int startIndex = typename.IndexOf('<'); int endIndex = typename.LastIndexOf('>'); string itemType = typename.Substring(startIndex + 1, endIndex - startIndex - 1); ArrayCsExporter.GenerateCode(obj, stream, indent, itemType, var); } // Struct type else if (Plugin.IsCustomClassType(type)) { retStr = var; if (!string.IsNullOrEmpty(typename)) { stream.WriteLine("{0}{1} {2};", indent, typename, var); } StructCsExporter.GenerateCode(obj, stream, indent, var, null, ""); } // Other types else { retStr = obj.ToString(); if (Plugin.IsStringType(type)) // string { retStr = string.Format("\"{0}\"", retStr); } else if (Plugin.IsCharType(type)) // char { char c = 'A'; if (retStr.Length >= 1) { c = retStr[0]; } retStr = string.Format("\'{0}\'", c); } else if (Plugin.IsBooleanType(type)) // bool { retStr = retStr.ToLowerInvariant(); } else if (Plugin.IsEnumType(type)) // enum { retStr = EnumCsExporter.GeneratedCode(obj); } else if (type == typeof(float)) // float { retStr += "f"; } if (!string.IsNullOrEmpty(var)) { if (string.IsNullOrEmpty(typename)) { stream.WriteLine("{0}{1} = {2};", indent, var, retStr); } else { stream.WriteLine("{0}{1} {2} = {3};", indent, typename, var, retStr); } } } } return(retStr); }
private DesignerPropertyEditor createPropertyEditor(PropertyDef property) { Type type = property.Type; Type editorType = Plugin.InvokeEditorType(type); Debug.Check(editorType != null); DesignerPropertyEditor editor = (DesignerPropertyEditor)editorType.InvokeMember(string.Empty, BindingFlags.CreateInstance, null, null, new object[0]); editor.TabStop = false; editor.Dock = System.Windows.Forms.DockStyle.Fill; editor.Margin = new System.Windows.Forms.Padding(0); editor.ValueWasChanged += new DesignerPropertyEditor.ValueChanged(editor_ValueWasChanged); VariableDef var = new VariableDef(Plugin.DefaultValue(type)); editor.SetVariable(var, null); editor.ValueWasAssigned(); return editor; }
public override bool ResetMembers(bool check, AgentType agentType, bool clear, MethodDef method = null, PropertyDef property = null) { bool bReset = false; if (this.Opl != null) { bReset |= this.Opl.ResetMembers(check, agentType, clear, method, property); } if (this.Opr1 != null) { bReset |= this.Opr1.ResetMembers(check, agentType, clear, method, property); } if (this.Opr2 != null) { bReset |= this.Opr2.ResetMembers(check, agentType, clear, method, property); } bReset |= base.ResetMembers(check, agentType, clear, method, property); if (!check && bReset) { OnPropertyValueChanged(false); } return bReset; }
public bool ResetMembers(bool check, AgentType agentType, bool clear, MethodDef method, PropertyDef property) { bool bReset = false; if (method != null) { if (method.OldName == this.Name) { bReset = true; if (!check) { this.CopyFrom(method); } } } else if (property != null) { foreach (MethodDef.Param param in this.Params) { if (param.Value is VariableDef) { VariableDef var = param.Value as VariableDef; bReset |= var.ResetMembers(check, agentType, clear, property); } else if (param.Value is ParInfo) { ParInfo par = param.Value as ParInfo; if (property.IsPar && (property.OldName == par.Name || !property.IsArrayElement && par.IsArrayElement && (property.OldName + "[]") == par.Name)) { if (clear || this.ShouldBeCleared(agentType)) { bReset = true; if (!check) { param.Value = Plugin.DefaultValue(param.Type); } } else { bReset = true; if (!check) { bool isArrayElement = par.IsArrayElement; par.CopyFrom(property); if (isArrayElement) { par.SetArrayElement(property); } } } } } } } return bReset; }
public static string GetGeneratedPropertyDefaultValue(PropertyDef prop, string typename) { return (prop != null) ? GetGeneratedDefaultValue(prop.Type, typename, prop.DefaultValue) : null; }
public virtual void CopyFrom(PropertyDef other) { if (other == null) return; _agentType = other._agentType; _propertyInfo = other._propertyInfo; _type = other._type; _isChangeableType = other._isChangeableType; _isStatic = other._isStatic; _isPublic = other._isPublic; _isProperty = other._isProperty; _isReadonly = other._isReadonly; _classname = other._classname; _owner = other._owner; _name = other._name; _nativeType = other._nativeType; _displayName = other._displayName; _description = other._description; _isAddedAutomatically = other._isAddedAutomatically; _isArrayElement = other._isArrayElement; _isExportedButAlsoCustomized = other._isExportedButAlsoCustomized; if (other._variable != null) { _variable = (VariableDef)other._variable.Clone(); } }
private void resetMembersInWorkspace(AgentType agentType, bool clear, MethodDef method, PropertyDef property) { foreach(Nodes.BehaviorNode behavior in getAllBehaviors(property)) { if (behavior != null && behavior is Nodes.Node) { bool bReset = ((Nodes.Node)behavior).ResetMembers(false, agentType, clear, method, property); if (bReset) UndoManager.Save(behavior); } } }
public VariableDef(VariableDef other) { if (other == null) { Value = null; } else { _property = null; if (other._property != null) { if (other._property.IsPar && other._property is ParInfo) { _property = new ParInfo(other._property as ParInfo); } else { _property = new PropertyDef(other._property); } } _value = Plugin.CloneValue(other._value); ValueClass = other._valueClass; if (other.m_arrayIndexElement != null) { m_arrayIndexElement = new MethodDef.Param(other.m_arrayIndexElement); } } }
public MemberItem(string displayName, PropertyDef property) { DisplayName = displayName; Property = property; }
public void SetProperty(PropertyDef property, string valueType) { ValueClass = valueType; if (property != null && property.Owner != valueType) { _property = property.Clone(); _property.Owner = valueType; } else { _property = property; } }
private bool checkMembersInWorkspace(AgentType agentType, bool clear, MethodDef method, PropertyDef property) { foreach(Nodes.BehaviorNode behavior in getAllBehaviors(property)) { if (behavior != null && behavior is Nodes.Node) { bool bReset = ((Nodes.Node)behavior).ResetMembers(true, agentType, clear, method, property); if (bReset) return DialogResult.Yes == MessageBox.Show(Resources.ModifyMemberWarning, Resources.Warning, MessageBoxButtons.YesNo); } } return true; }
public bool ResetMembers(bool check, AgentType agentType, bool clear, MethodDef method, PropertyDef property) { if (this.IsMethod && this.Method != null) { if (method != null && method.OldName == this.Method.Name) { if (!check) { if (clear || this.Method.ShouldBeCleared(agentType)) { this.m_method = null; } else { this.Method.CopyFrom(method); } } return true; } return this.Method.ResetMembers(check, agentType, clear, method, property); } else if (this.Var != null) { return this.Var.ResetMembers(check, agentType, clear, property); } return false; }
IList<Nodes.BehaviorNode> getAllBehaviors(PropertyDef property) { List<Nodes.BehaviorNode> allBehaviors = new List<Nodes.BehaviorNode>(); if (property != null && property.IsPar) { allBehaviors.Add(getCurrentRootNode()); } else { BehaviorTreeList behaviorTreeList = BehaviorManager.Instance as BehaviorTreeList; if (behaviorTreeList != null) { foreach(Nodes.BehaviorNode behavior in behaviorTreeList.GetAllOpenedBehaviors()) { if (!allBehaviors.Contains(behavior)) { allBehaviors.Add(behavior); } } foreach(Nodes.BehaviorNode behavior in behaviorTreeList.GetAllBehaviors()) { if (!allBehaviors.Contains(behavior)) { allBehaviors.Add(behavior); } } } } return allBehaviors; }
public override void CopyFrom(PropertyDef other) { base.CopyFrom(other); if (other is ParInfo) { ParInfo otherPar = other as ParInfo; _node = otherPar._node; _eventParam = otherPar._eventParam; _typeName = otherPar._typeName; _display = otherPar._display; } }
public void Initialize(bool canBeEdit, AgentType agent, StructType structType, PropertyDef prop, bool canBePar) { Debug.Check(agent != null || structType != null); _initialized = false; _isModified = false; _shouldCheckMembersInWorkspace = false; _isNew = (prop == null); _agent = agent; _structType = structType; _originalProperty = prop; setTypes(); if (_isNew) { this.Text = canBeEdit ? Resources.AddProperty : Resources.ViewProperty; if (_structType == null) { if (agent != null) { _property = new PropertyDef(agent, null, agent.Name, "", "", ""); } } else { _property = new PropertyDef(null, null, _structType.Name, "", "", ""); } _property.IsPublic = false; resetProperty(_property, _property.IsPar); } else { this.Text = canBeEdit ? Resources.EditProperty : Resources.ViewProperty; resetProperty(prop, prop.IsPar); } //this.customizedCheckBox.Visible = canBeEdit && !_property.IsInherited && agent != null; this.customizedCheckBox.Visible = false; this.isLocalCheckBox.Checked = _structType == null && _property.IsPar; this.isLocalCheckBox.Visible = canBePar && _structType == null && !_property.IsMember; this.isLocalCheckBox.Enabled = canBeEdit; this.nameTextBox.Enabled = canBeEdit; this.arrayCheckBox.Enabled = canBeEdit || (_structType == null || _structType.IsCustomized) && _property.IsChangeableType; this.typeComboBox.Enabled = canBeEdit || (_structType == null || _structType.IsCustomized) && _property.IsChangeableType; this.isStaticCheckBox.Enabled = canBeEdit; this.isPublicCheckBox.Enabled = canBeEdit; this.isConstCheckBox.Enabled = canBeEdit; this.dispTextBox.Enabled = canBeEdit; this.descTextBox.Enabled = canBeEdit; this.nameTextBox.Focus(); if (this.nameTextBox.TextLength > 0) { this.nameTextBox.SelectionStart = this.nameTextBox.TextLength; } else { this.nameTextBox.Select(); } _initialized = true; }