public static void GenerateClassMember(Behaviac.Design.VariableDef variable, StreamWriter stream, string indent, string var) { if (variable.ValueClass == Behaviac.Design.VariableDef.kConst) { Type type = variable.Value.GetType(); if (Plugin.IsArrayType(type) || Plugin.IsCustomClassType(type) || (Plugin.IsStringType(type) && !variable.IsConst)) { string nativeType = DataCsExporter.GetGeneratedNativeType(variable.NativeType); bool setNull = Plugin.IsArrayType(type); if (!setNull && Plugin.IsCustomClassType(type)) { Attribute[] attributes = (Attribute[])type.GetCustomAttributes(typeof(Behaviac.Design.ClassDescAttribute), false); if (attributes.Length > 0) { Behaviac.Design.ClassDescAttribute classDesc = (Behaviac.Design.ClassDescAttribute)attributes[0]; if (!classDesc.IsStruct) { setNull = true; } } } if (setNull) { var += " = null"; } stream.WriteLine("{0}\t\t{1} {2};", indent, nativeType, var); } } }
public static string GenerateCode(Behaviac.Design.VariableDef variable, bool isRefParam, StreamWriter stream, string indent, string typename, string var, string caller) { string retStr = string.Empty; if (variable.ValueClass == Behaviac.Design.VariableDef.kConst) { bool shouldGenerate = true; Type type = variable.Value.GetType(); if (Plugin.IsArrayType(type) || Plugin.IsCustomClassType(type) || (Plugin.IsStringType(type) && !variable.IsConst)) { shouldGenerate = false; } if (shouldGenerate) { retStr = DataCppExporter.GenerateCode(variable.Value, stream, indent, typename, var, caller); } } else if (variable.Property != null) { retStr = PropertyCppExporter.GenerateCode(variable.Property, variable.ArrayIndexElement, isRefParam, stream, indent, typename, var, caller); } return(retStr); }
public static void PostGenerateCode(Behaviac.Design.MethodDef.Param param, StringWriter stream, string indent, string typename, string var, string caller, object parent, string setValue) { Behaviac.Design.ParInfo par = param.Value as Behaviac.Design.ParInfo; if (par != null) { ParInfoCsExporter.PostGenerateCode(par, null, stream, indent, typename, var, caller); return; } Behaviac.Design.VariableDef v = param.Value as Behaviac.Design.VariableDef; if (v != null) { VariableCsExporter.PostGenerateCode(v, stream, indent, typename, var, caller, parent, param.Name, setValue); return; } Type type = param.Value.GetType(); if (Plugin.IsCustomClassType(type) && !DesignerStruct.IsPureConstDatum(param.Value, parent, param.Name)) { StructCsExporter.PostGenerateCode(param.Value, stream, indent, var, parent, param.Name); } }
public static void GenerateClassConstructor(Behaviac.Design.VariableDef variable, StreamWriter stream, string indent, string var) { if (variable.ValueClass == Behaviac.Design.VariableDef.kConst) { Type type = variable.Value.GetType(); if (Plugin.IsRefType(type)) { string nativeType = DataCppExporter.GetBasicGeneratedNativeType(variable.NativeType); stream.WriteLine("{0}\t\t\t{1} = NULL;", indent, var); } else if (Plugin.IsArrayType(type) || Plugin.IsCustomClassType(type) || (Plugin.IsStringType(type) && !variable.IsConst)) { if (Plugin.IsArrayType(type)) { string nativeType = DataCppExporter.GetGeneratedNativeType(variable.NativeType); int startIndex = nativeType.IndexOf('<'); int endIndex = nativeType.LastIndexOf('>'); string itemType = nativeType.Substring(startIndex + 1, endIndex - startIndex - 1); ArrayCppExporter.GenerateCode(variable.Value, stream, indent + "\t\t\t", itemType, var); } else if (Plugin.IsCustomClassType(type)) { StructCppExporter.GenerateCode(variable.Value, stream, indent + "\t\t\t", var, null, ""); } else if ((Plugin.IsStringType(type) && !variable.IsConst)) { string nativeType = DataCppExporter.GetBasicGeneratedNativeType(variable.NativeType); string retStr = DataCppExporter.GenerateCode(variable.Value, stream, indent + "\t\t\t", nativeType, string.Empty, string.Empty); stream.WriteLine("{0}\t\t\t{1} = {2};", indent, var, retStr); } } } }
public static void PostGenerateCode(Behaviac.Design.VariableDef variable, StreamWriter stream, string indent, string typename, string var, string caller, object parent = null, string paramName = "", string setValue = null) { if (variable.ValueClass == Behaviac.Design.VariableDef.kConst) { Type type = variable.Value.GetType(); if (Plugin.IsCustomClassType(type) && !DesignerStruct.IsPureConstDatum(variable.Value, parent, paramName)) { StructCppExporter.PostGenerateCode(variable.Value, stream, indent, var, parent, paramName); } } else if (variable.Property != null) { PropertyCppExporter.PostGenerateCode(variable.Property, stream, indent, typename, var, caller, setValue); } }
public static string GenerateCode(DefaultObject defaultObj, Behaviac.Design.MethodDef.Param param, StreamWriter stream, string indent, string typename, string var, string caller) { Behaviac.Design.ParInfo par = param.Value as Behaviac.Design.ParInfo; if (par != null) { return(ParInfoCppExporter.GenerateCode(par, param.IsRef, stream, indent, typename, var, caller)); } Behaviac.Design.VariableDef v = param.Value as Behaviac.Design.VariableDef; if (v != null) { return(VariableCppExporter.GenerateCode(defaultObj, v, param.IsRef, stream, indent, typename, var, caller)); } return(DataCppExporter.GenerateCode(param.Value, defaultObj, stream, indent, typename, var, caller)); }
public bool CheckPar(ParInfo par) { foreach (MethodDef.Param param in this.Params) { if (param.Value is VariableDef) { VariableDef var = param.Value as VariableDef; return(var.CheckPar(par)); } else if (param.Value is ParInfo) { if (par.GetExportValue() == ((ParInfo)(param.Value)).GetExportValue()) { return(true); } } } return(false); }
public static void GenerateClassMember(Behaviac.Design.VariableDef variable, StreamWriter stream, string indent, string var) { if (variable.ValueClass == Behaviac.Design.VariableDef.kConst) { Type type = variable.Value.GetType(); string nativeType = DataCppExporter.GetBasicGeneratedNativeType(variable.NativeType); if (Plugin.IsRefType(type)) { if (!nativeType.EndsWith("*")) { nativeType += "*"; } stream.WriteLine("{0}\t\t{1} {2};", indent, nativeType, var); } else if (Plugin.IsArrayType(type) || Plugin.IsCustomClassType(type) || (Plugin.IsStringType(type) && !variable.IsConst)) { stream.WriteLine("{0}\t\t{1} {2};", indent, nativeType, var); } } }
public bool ShouldBeReset(AgentType agentType, bool resetPar) { foreach (MethodDef.Param param in this.Params) { if (param.Value is VariableDef) { VariableDef var = param.Value as VariableDef; if (var.ShouldBeReset(agentType, resetPar)) { param.Value = Plugin.DefaultValue(param.Type); } } else if (resetPar && param.Value is ParInfo) { param.Value = Plugin.DefaultValue(param.Type); } } return(this.Owner == VariableDef.kSelf && !Plugin.IsAgentDerived(this.AgentType.AgentTypeName, agentType.AgentTypeName)); }
public bool SetProperty(BehaviorNode behavior, string valueName, string valueStr) { DesignerPropertyEditor propertyEditor = getPropertyEditor(valueName); if (propertyEditor == null && behavior != null) { Node root = behavior as Node; foreach (PropertyDef p in root.LocalVars) { if (!p.IsArrayElement && p.BasicName == valueName) { propertyEditor = addRowControl(p); break; } } } if (propertyEditor == null) { return(false); } VariableDef var = propertyEditor.GetVariable(); if (var.Value.ToString().ToLower() != valueStr.ToLower()) { Plugin.InvokeTypeParser(null, var.ValueType, valueStr, (object value) => var.Value = value, null); propertyEditor.ValueWasnotAssigned(); propertyEditor.SetVariable(var, null); propertyEditor.ValueWasAssigned(); return(true); } return(false); }
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 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 UpdateProperties(IList<DesignerPropertyInfo> properties, List<MethodDef.Param> parameters, string parametersCategory) private void UpdateProperties(IList <DesignerPropertyInfo> properties) { DefaultObject obj = SelectedObject as DefaultObject; if (obj != null) { uiPolicy = obj.CreateUIPolicy(); uiPolicy.Initialize(obj); } List <string> categories = new List <string>(); foreach (DesignerPropertyInfo property in properties) { if (uiPolicy.ShouldAddProperty(property) && !property.Attribute.HasFlags(DesignerProperty.DesignerFlags.NoDisplay) && (property.Attribute.CategoryResourceString != "CategoryVersion" || Settings.Default.ShowVersionInfo) && !categories.Contains(property.Attribute.CategoryResourceString)) { categories.Add(property.Attribute.CategoryResourceString); } } categories.Sort(new CategorySorter()); foreach (string category in categories) { propertyGrid.AddCategory(Plugin.GetResourceString(category), true); foreach (DesignerPropertyInfo property in properties) { if (!property.Attribute.HasFlags(DesignerProperty.DesignerFlags.NoDisplay) && property.Attribute.CategoryResourceString == category) { if (uiPolicy != null && !uiPolicy.ShouldAddProperty(property)) { continue; } object value_ = property.Property.GetValue(_selectedObject, null); Type type = property.Attribute.GetEditorType(value_); DesignerMethodEnum propertyMethod = property.Attribute as DesignerMethodEnum; if (propertyMethod != null) { if ((propertyMethod.MethodType & MethodType.Task) == MethodType.Task) { type = typeof(DesignerMethodEnumEditor); } } string displayName = property.Attribute.DisplayName; if (uiPolicy != null) { displayName = uiPolicy.GetLabel(property); } Label label = propertyGrid.AddProperty(displayName, type, property.Attribute.HasFlags(DesignerProperty.DesignerFlags.ReadOnly)); // register description showing label.MouseEnter += new EventHandler(label_MouseEnter); // when we found an editor we connect it to the object if (type != null) { DesignerPropertyEditor editor = (DesignerPropertyEditor)label.Tag; editor.SetRootNode((Nodes.Node) this._rootBehavior); editor.SetProperty(property, _selectedObject); editor.ValueWasAssigned(); editor.MouseEnter += editor_MouseEnter; editor.DescriptionWasChanged += editor_DescriptionWasChanged; editor.ValueWasChanged += editor_ValueWasChanged; if (uiPolicy != null) { uiPolicy.AddEditor(editor); } } MethodDef method = null; bool methodEditorEnable = true; if (propertyMethod != null) { if (propertyMethod.MethodType != MethodType.Status) { method = value_ as MethodDef; //methodEditorEnable = (propertyMethod.MethodType != MethodType.Event); } } else { DesignerRightValueEnum propertyRV = property.Attribute as DesignerRightValueEnum; if (propertyRV != null) { RightValueDef rv = value_ as RightValueDef; if (rv != null && rv.IsMethod) { method = rv.Method; } } } if (property.Attribute != null) { if (method != null) { if (property.Attribute.HasFlags(DesignerProperty.DesignerFlags.NoDisplayOnProperty)) { //don't dipslay on the property panel } else { bool bReadonly = property.Attribute.HasFlags(DesignerProperty.DesignerFlags.ReadOnlyParams); createParamEditor(method, methodEditorEnable, bReadonly); } } else { MethodDef.Param arrayIndexElement = null; if (value_ is VariableDef) { VariableDef var = value_ as VariableDef; arrayIndexElement = var.ArrayIndexElement; } else if (value_ is RightValueDef) { RightValueDef varRV = value_ as RightValueDef; if (varRV.Var != null) { arrayIndexElement = varRV.Var.ArrayIndexElement; } } if (arrayIndexElement != null) { createArrayIndexEditor(" ", arrayIndexElement); } } } } } } if (uiPolicy != null) { uiPolicy.Update(null, new DesignerPropertyInfo()); } }
public static object CloneValue(object value) { object clone = value; if (value != null) { if (value is VariableDef) { clone = new VariableDef((VariableDef)value); } else if (value is RightValueDef) { clone = ((RightValueDef)value).Clone(); } else if (value is ParInfo) { clone = new ParInfo((ParInfo)value); } else { Type type = value.GetType(); if (Plugin.IsArrayType(type)) { clone = Plugin.CreateInstance(type); System.Collections.IList listValue = (System.Collections.IList)value; System.Collections.IList listClone = (System.Collections.IList)clone; foreach (object item in listValue) { object cloneValue = CloneValue(item); listClone.Add(cloneValue); } } else if (Plugin.IsCustomClassType(type)) { clone = Plugin.CreateInstance(type); try { foreach (PropertyInfo property in type.GetProperties()) { object cloneValue = CloneValue(property.GetValue(value, null)); property.SetValue(clone, cloneValue, null); } } catch { } } } } // Primitive type return clone; }
public override void ResetMembers(AgentType agentType, bool resetPar) { if (this.Opl != null && this.Opl.ShouldBeReset(agentType, resetPar)) { this.Opl = null; } if (this.Opr != null && this.Opr.ShouldBeReset(agentType, resetPar)) { this.Opr = null; } base.ResetMembers(agentType, resetPar); }
public static object CloneValue(object value) { object clone = value; if (value != null) { if (value is VariableDef) { clone = new VariableDef((VariableDef)value); } else if (value is RightValueDef) { clone = ((RightValueDef)value).Clone(); } else if (value is ParInfo) { clone = new ParInfo((ParInfo)value); } else { Type type = value.GetType(); if (Plugin.IsArrayType(type)) { clone = Plugin.CreateInstance(type); System.Collections.IList listValue = (System.Collections.IList)value; System.Collections.IList listClone = (System.Collections.IList)clone; foreach(object item in listValue) { object cloneValue = CloneValue(item); listClone.Add(cloneValue); } } else if (Plugin.IsCustomClassType(type)) { clone = Plugin.CreateInstance(type); try { foreach(PropertyInfo property in type.GetProperties()) { object cloneValue = property.GetValue(value, null); if (property.PropertyType != type) { cloneValue = CloneValue(cloneValue); } if (property.CanWrite) { property.SetValue(clone, cloneValue, null); } else { DesignerProperty[] attributes = (DesignerProperty[])property.GetCustomAttributes(typeof(DesignerProperty), false); if (attributes.Length > 0) { Debug.Check(attributes[0].HasFlags(DesignerProperty.DesignerFlags.ReadOnly)); } } } } catch { } } } } // Primitive type return clone; }
/// <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); }
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 void Copy(ParInfo other) { _node = other._node; _name = other._name; _eventParam = other._eventParam; _typeName = other._typeName; _description = other._description; if (other._variable != null) _variable = (VariableDef)other._variable.Clone(); }
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; }
/// <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); }
public RightValueDef(VariableDef var) { m_var = var; if (m_var != null) { _valueClass = m_var.ValueClass; } }
public VariableDef(VariableDef other) { if (other == null) { Value = null; } else { _property = (other._property != null) ? new PropertyDef(other._property) : null; _value = Plugin.CloneValue(other._value); ValueClass = other._valueClass; } }