public Intention( decimal lowestPrice, decimal maximumPrice, int bedroom, EState state, string city, string neighborhood, EPropertyType propertyType, EPropertySituation propertySituation) { LowestPrice = lowestPrice; MaximumPrice = maximumPrice; Bedroom = bedroom; State = state; City = city; Neighborhood = neighborhood; PropertyType = propertyType; PropertySituation = propertySituation; AddNotifications(new Contract() .Requires() .IsNotNullOrEmpty(City, "Intention.City", "Cidade deve ser preenchido.") .HasMaxLen(City, 50, "Intention.City", "Cidade excedeu o tamanho máximo.") .IsNotNullOrEmpty(Neighborhood, "Intention.Neighborhood", "Bairro deve ser preenchido.") .HasMaxLen(Neighborhood, 50, "Intention.Neighborhood", "Bairro excedeu o tamanho máximo.") .IsGreaterThan(MaximumPrice, LowestPrice, "Intention.LowestPrice", "Preço minímo não pode ser maior que preço máximo.")); }
public PropertyDescriptor(string text, EPropertyType type, object propObject, Action <object> changedCallback) { Text = text; Type = type; PropObject = propObject; ChangedCallback = changedCallback; }
/// <summary> /// Change properties of other controls based on the selection. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e) { if ((!(sender is ComboBox combo)) || !this.IsLoaded) { return; } EPropertyType type = (EPropertyType)combo.SelectedIndex; MessageBoxResult result = MessageBox.Show("This may remove property values.\nDo you wish to continue?", "Caution", MessageBoxButton.YesNoCancel); if (result == MessageBoxResult.Yes) { UpdateUI(type); } }
public CreateIntentionCommand( Guid prospectId, decimal?rent, decimal lowestPrice, decimal maximumPrice, int bedroom, EState state, string city, string neighborhood, EPropertyType propertyType, EPropertySituation propertySituation) { ProspectId = prospectId; Rent = rent; LowestPrice = lowestPrice; MaximumPrice = maximumPrice; Bedroom = bedroom; State = state; City = city; Neighborhood = neighborhood; PropertyType = propertyType; PropertySituation = propertySituation; }
private void AddSt(ILProcessor processor, List <Instruction> instructions, ParameterDefinition param, FieldDefinition field, VariableDefinition var, EPropertyType typeCode) { if (param != null) { if (param.IsOut || param.ParameterType.IsByReference) { // Parameter is ref/out, use the appropriate st opcode instructions.Add(CreateStRefOutParam(processor, param, typeCode)); } else { instructions.Add(processor.Create(OpCodes.Starg, param)); } } else if (field != null) { instructions.Add(processor.Create(OpCodes.Stfld, field)); } else if (var != null) { instructions.Add(processor.Create(OpCodes.Stloc, var)); } }
private MethodReference GetToNativeMarshaler(ManagedUnrealMarshalerType marshalerType, EPropertyType typeCode, string typePath, EPropertyType arg1TypeCode = EPropertyType.Unknown, string arg1TypePath = null, EPropertyType arg2TypeCode = EPropertyType.Unknown, string arg2TypePath = null) { ManagedUnrealMarshalerInfo marshalerInfo = new ManagedUnrealMarshalerInfo( typeCode, typePath, arg1TypeCode, arg1TypePath, arg2TypeCode, arg2TypePath, marshalerType); MethodReference method; if (toNativeMarshalers.TryGetValue(marshalerInfo, out method)) { return(method); } int paramCount = marshalerToNativeParamCountMin; if (!codeSettings.MinimalMarshalingParams || ManagedUnrealTypeInfo.MarshalerRequiresNativePropertyField(typeCode)) { paramCount = marshalerToNativeParamCount; } Type type = ManagedUnrealTypeInfo.GetTypeFromMarshalerInfo(marshalerInfo); if (type != null) { if (typeCode == EPropertyType.Struct && !type.IsGenericType) { // Struct marshaling methods are generated, find the existing type by path TypeDefinition typeDef = typeDef = assembly.MainModule.GetType(type.FullName); foreach (MethodDefinition methodDef in typeDef.Methods) { if (methodDef.Name == "ToNative" && methodDef.IsPublic && methodDef.IsStatic && methodDef.Parameters.Count == paramCount) { method = methodDef; break; } } } else { foreach (System.Reflection.MethodInfo methodInfo in type.GetMethods()) { if (methodInfo.Name == "ToNative" && methodInfo.IsPublic && methodInfo.GetParameters().Length == paramCount && (methodInfo.IsStatic || ManagedUnrealTypeInfo.IsCollectionType(typeCode))) { method = assembly.MainModule.ImportEx(methodInfo); break; } } } } if (method != null) { toNativeMarshalers.Add(marshalerInfo, method); } if (method == null) { throw new RewriteException(typePath, "Failed to get ToNative marshaler"); } return(method); }
private Instruction[] CreateSetDefaultValue(ILProcessor processor, EPropertyType typeCode, ParameterDefinition param, FieldDefinition field, VariableDefinition var) { List <Instruction> instructions = new List <Instruction>(); switch (typeCode) { case EPropertyType.Bool: case EPropertyType.Int8: case EPropertyType.Byte: case EPropertyType.Int: case EPropertyType.UInt32: case EPropertyType.Int16: case EPropertyType.UInt16: case EPropertyType.Enum: AddLdArgIfRefOrOut(processor, instructions, param); instructions.Add(processor.Create(OpCodes.Ldc_I4_0)); AddSt(processor, instructions, param, field, var, typeCode); break; case EPropertyType.Int64: case EPropertyType.UInt64: AddLdArgIfRefOrOut(processor, instructions, param); instructions.Add(processor.Create(OpCodes.Ldc_I4_0)); instructions.Add(processor.Create(OpCodes.Conv_I8)); AddSt(processor, instructions, param, field, var, typeCode); break; case EPropertyType.Float: AddLdArgIfRefOrOut(processor, instructions, param); instructions.Add(processor.Create(OpCodes.Ldc_R4, 0.0f)); AddSt(processor, instructions, param, field, var, typeCode); break; case EPropertyType.Double: AddLdArgIfRefOrOut(processor, instructions, param); instructions.Add(processor.Create(OpCodes.Ldc_R8, 0.0)); AddSt(processor, instructions, param, field, var, typeCode); break; case EPropertyType.Struct: AddLda(processor, instructions, param, field, var); AddInitObj(processor, instructions, param, field, var); break; case EPropertyType.LazyObject: case EPropertyType.WeakObject: case EPropertyType.SoftClass: case EPropertyType.SoftObject: case EPropertyType.Class: // Assumes these are all struct types AddLda(processor, instructions, param, field, var); AddInitObj(processor, instructions, param, field, var); break; default: AddLdArgIfRefOrOut(processor, instructions, param); instructions.Add(processor.Create(OpCodes.Ldnull)); AddSt(processor, instructions, param, field, var, typeCode); break; } return(instructions.ToArray()); }
private IntPtr CreateProperty(IntPtr outer, Type type, string propertyName, EPropertyType propertyType) { return(CreateProperty(outer, type, propertyName, propertyType, EPropertyType.Unknown, EPropertyType.Unknown)); }
private void UpdateUI(EPropertyType type) { switch (type) { case EPropertyType.CheckBox: values.IsEnabled = false; PropertyItem.Values.Clear(); PropertyItem.Values.Add("True"); PropertyItem.Values.Add("False"); values.SelectedItem = null; value.IsEnabled = false; PropertyItem.Regex = "[True|False]"; add.IsEnabled = false; delete.IsEnabled = false; break; case EPropertyType.ComboBox: if (PropertyItem?.Type.EPropertyType == EPropertyType.CheckBox) { PropertyItem.Values.Clear(); PropertyItem.Regex = ".*"; } values.IsEnabled = true; value.IsEnabled = true; add.IsEnabled = true; delete.IsEnabled = true; break; case EPropertyType.ComboBoxEdit: if (PropertyItem?.Type.EPropertyType == EPropertyType.CheckBox) { PropertyItem.Values.Clear(); PropertyItem.Regex = ".*"; } values.IsEnabled = true; value.IsEnabled = true; add.IsEnabled = true; delete.IsEnabled = true; break; case EPropertyType.TextBox: if (PropertyItem?.Type.EPropertyType == EPropertyType.CheckBox) { PropertyItem.Values.Clear(); PropertyItem.Regex = ".*"; } if ((PropertyItem?.Type.EPropertyType == EPropertyType.TextBox) && PropertyItem.Values.Count == 0) { add.IsEnabled = true; } else { add.IsEnabled = false; } values.IsEnabled = true; value.IsEnabled = true; delete.IsEnabled = true; break; default: break; } }
public bool Update(IntPtr address) { if (Address != address) { Address = address; Size = 0; ArrayDim = 0; IsEditConst = false; IsBlueprintReadOnly = false; GenericArg1Address = IntPtr.Zero; GenericArg1Size = 0; GenericArg1ArrayDim = 0; GenericArg2Address = IntPtr.Zero; GenericArg2Size = 0; GenericArg2ArrayDim = 0; PropertyType = EPropertyType.Unknown; if (address == IntPtr.Zero) { return(true); } EPropertyType propertyType = NativeReflection.GetPropertyType(address); if (propertyType != EPropertyType.Unknown) { PropertyType = propertyType; Size = Native_UProperty.Get_ElementSize(address); ArrayDim = Native_UProperty.Get_ArrayDim(address); IsEditConst = Native_UProperty.HasAnyPropertyFlags(address, EPropertyFlags.EditConst); IsBlueprintReadOnly = Native_UProperty.HasAnyPropertyFlags(address, EPropertyFlags.BlueprintReadOnly); switch (propertyType) { case EPropertyType.Array: GenericArg1Address = Native_UArrayProperty.Get_Inner(address); if (GenericArg1Address != IntPtr.Zero) { GenericArg1Size = Native_UProperty.Get_ElementSize(GenericArg1Address); GenericArg1ArrayDim = Native_UProperty.Get_ArrayDim(GenericArg1Address); } break; case EPropertyType.Map: GenericArg1Address = Native_UMapProperty.Get_KeyProp(address); if (GenericArg1Address != IntPtr.Zero) { GenericArg1Size = Native_UProperty.Get_ElementSize(GenericArg1Address); GenericArg1ArrayDim = Native_UProperty.Get_ArrayDim(GenericArg1Address); } GenericArg2Address = Native_UMapProperty.Get_ValueProp(address); if (GenericArg2Address != IntPtr.Zero) { GenericArg2Size = Native_UProperty.Get_ElementSize(GenericArg2Address); GenericArg2ArrayDim = Native_UProperty.Get_ArrayDim(GenericArg2Address); } break; case EPropertyType.Set: GenericArg1Address = Native_USetProperty.Get_ElementProp(address); if (GenericArg1Address != IntPtr.Zero) { GenericArg1Size = Native_UProperty.Get_ElementSize(GenericArg1Address); GenericArg1ArrayDim = Native_UProperty.Get_ArrayDim(GenericArg1Address); } break; } } return(true); } return(false); }
public UnrealMarshalerTypeNotFoundException(EPropertyType typeCode, string typePath) : base("Failed to find type path for marshaler " + typeCode + " " + typePath) { }
/// <summary> /// Creates a st opcode for a ref/out param taking what is currently on the stack /// </summary> private Instruction CreateStRefOutParam(ILProcessor processor, ParameterDefinition param, EPropertyType paramTypeCode) { switch (paramTypeCode) { case EPropertyType.Enum: return(CreateStRefOutParam(processor, null, GetPrimitiveTypeCode(param.ParameterType.Resolve().GetEnumUnderlyingType()))); case EPropertyType.Bool: case EPropertyType.Int8: case EPropertyType.Byte: return(processor.Create(OpCodes.Stind_I1)); case EPropertyType.Int16: case EPropertyType.UInt16: return(processor.Create(OpCodes.Stind_I2)); case EPropertyType.Int: case EPropertyType.UInt32: return(processor.Create(OpCodes.Stind_I4)); case EPropertyType.Int64: case EPropertyType.UInt64: return(processor.Create(OpCodes.Stind_I8)); case EPropertyType.Float: return(processor.Create(OpCodes.Stind_R4)); case EPropertyType.Double: return(processor.Create(OpCodes.Stind_R8)); case EPropertyType.Struct: Debug.Assert(!param.ParameterType.IsValueType); // Should be a ref to a struct return(processor.Create(OpCodes.Stobj, param.ParameterType.GetElementType())); case EPropertyType.LazyObject: case EPropertyType.WeakObject: case EPropertyType.SoftClass: case EPropertyType.SoftObject: case EPropertyType.Class: // Assumes these are all struct types Debug.Assert(!param.ParameterType.IsValueType); // Should be a ref to a struct return(processor.Create(OpCodes.Stobj, param.ParameterType.GetElementType())); case EPropertyType.Delegate: case EPropertyType.MulticastDelegate: // Delegate/multicast delegates in C# are implemented as classes, use Stind_Ref return(processor.Create(OpCodes.Stind_Ref)); case EPropertyType.InternalManagedFixedSizeArray: case EPropertyType.InternalNativeFixedSizeArray: throw new NotImplementedException(); // Fixed size arrays not supported as args case EPropertyType.Array: case EPropertyType.Set: case EPropertyType.Map: // Assumes this will be always be an object (IList, List, ISet, HashSet, IDictionary, Dictionary) return(processor.Create(OpCodes.Stind_Ref)); default: return(processor.Create(OpCodes.Stind_Ref)); } }
private Instruction[] CreateSetDefaultValue(ILProcessor processor, EPropertyType typeCode, FieldDefinition field) { return(CreateSetDefaultValue(processor, typeCode, null, field, null)); }
internal void RemoveHeader(string stHeaderName, EPropertyType prop = EPropertyType.XHdrProp) { _Log.DebugFormat("RemoveHader(): Removing '{0}' for mail: {1}", stHeaderName, _mail.Message.Subject); try { MimePart tnefPart = _mail.Message.TnefPart; MimeDocument mdMimeDoc = _mail.Message.MimeDocument; HeaderList hlHeaderlist = mdMimeDoc.RootPart.Headers; _Log.DebugFormat("RemoveHader(): Tnef null: {0}, mimedoc null: {1}, header list: {2}", tnefPart == null, mdMimeDoc == null, hlHeaderlist == null); Header hdr = hlHeaderlist.FindFirst(stHeaderName); _Log.DebugFormat("RemoveHader(): {0} header found: {1}", stHeaderName, hdr != null); if (hdr != null) { MimeNode hdrRemoved = hlHeaderlist.RemoveChild(hdr); _Log.DebugFormat("RemoveHader(): Header removed: {0}", hdrRemoved != null); } } catch (Exception x) { _Log.ErrorFormat("RemoveHader(): Error - {0}", x.ToString()); } _Log.DebugFormat("RemoveHader(): Removed {0} for mail {1}", stHeaderName, _mail.Message.Subject); }
internal void SetProperty(string stPropName, string stPropVal, EPropertyType eProp = EPropertyType.XHdrProp) { _Log.DebugFormat("SetProperty() Setting property {0} - {1} for mail {2}", stPropName, stPropVal, _mail.Message.Subject); try { MimePart tnefPart = _mail.Message.TnefPart; MimeDocument mdMimeDoc = _mail.Message.MimeDocument; HeaderList hlHeaderlist = mdMimeDoc.RootPart.Headers; _Log.DebugFormat("SetHeader(): Tnef null: {0}, mimedoc null: {1}, header list: {2}", tnefPart == null, mdMimeDoc == null, hlHeaderlist == null); Header hdrToInsert = hlHeaderlist.FindFirst(stPropName); if (hdrToInsert == null) { _Log.DebugFormat("SetProperty(): Header does not exist. Inserting new."); TextHeader nhNewKeywords = new TextHeader(stPropName, stPropVal); MimeNode lhLasterHeader = hlHeaderlist.LastChild; MimeNode hdrNew = hlHeaderlist.InsertBefore(nhNewKeywords, lhLasterHeader); _Log.DebugFormat("SetProperty(): Header inserted: {0}", hdrNew == null); } else { _Log.DebugFormat("SetProperty(): Header exists. Updating value"); hdrToInsert.Value = stPropVal; } } catch (Exception x) { _Log.ErrorFormat("SetProperty(): Error - {0}", x.ToString()); } _Log.DebugFormat("SetProperty() Set property '{0} - {1}' for mail: {2}", stPropName, stPropVal, _mail.Message.Subject); }
private IntPtr CreateProperty(IntPtr outer, Type type, string propertyName, EPropertyType propertyType, EPropertyType innerPropertyType1, EPropertyType innerPropertyType2) { propertyType = ManagedUnrealTypes.GetPropertyType(type, propertyType); IntPtr propertyClass = ManagedUnrealTypes.GetPropertyClass(propertyType); if (propertyClass == IntPtr.Zero) { return(IntPtr.Zero); } EObjectFlags objectFlags = EObjectFlags.Public | EObjectFlags.Transient | EObjectFlags.MarkAsNative; IntPtr property = NativeReflection.NewObject(outer, propertyClass, new FName(propertyName), objectFlags); Native_UProperty.SetPropertyFlags(property, EPropertyFlags.BlueprintVisible | EPropertyFlags.BlueprintAssignable | EPropertyFlags.Edit); // Set type specific information switch (propertyType) { case EPropertyType.Array: if (!firstRun) { Native_UArrayProperty.Set_Inner(property, CreateProperty(property, typeof(int), propertyName, innerPropertyType1)); } else { Native_UArrayProperty.Set_Inner(property, CreateProperty(property, type.GenericTypeArguments[0], propertyName, innerPropertyType1)); } break; case EPropertyType.Set: Native_USetProperty.Set_ElementProp(property, CreateProperty(property, type.GenericTypeArguments[0], propertyName, innerPropertyType1)); break; case EPropertyType.Map: Native_UMapProperty.Set_KeyProp(property, CreateProperty(property, type.GenericTypeArguments[0], propertyName, innerPropertyType1)); Native_UMapProperty.Set_ValueProp(property, CreateProperty(property, type.GenericTypeArguments[1], propertyName, innerPropertyType2)); break; case EPropertyType.Class: Native_UClassProperty.SetMetaClass(property, UClass.GetClass(type.GenericTypeArguments[0]).Address); break; case EPropertyType.Object: var v1 = ManagedUnrealTypes.GetStaticClass(type); var v2 = ManagedUnrealTypes.GetStaticClass(typeof(UObject)); Native_UObjectPropertyBase.SetPropertyClass(property, v1 == IntPtr.Zero ? v2 : v1); break; case EPropertyType.LazyObject: case EPropertyType.WeakObject: case EPropertyType.SoftObject: Native_UObjectPropertyBase.SetPropertyClass(property, UClass.GetClass(type.GenericTypeArguments[0]).Address); break; case EPropertyType.SoftClass: Native_USoftClassProperty.SetMetaClass(property, UClass.GetClass(type.GenericTypeArguments[0]).Address); break; case EPropertyType.Enum: Native_UEnumProperty.SetEnum(property, ManagedUnrealTypes.GetEnum(type)); break; case EPropertyType.Delegate: //Native_UDelegateProperty.Set_SignatureFunction(property, ManagedUnrealTypes.GetSignatureFunction(type)); break; case EPropertyType.MulticastDelegate: //Native_UMulticastDelegateProperty.Set_SignatureFunction(property, ManagedUnrealTypes.GetSignatureFunction(type)); break; } Native_UField.AddCppProperty(outer, property); return(property); }
public Property(string name, object val) { m_name = name; m_type = EPropertyType.EPropertyType_Object; m_value = val; }
public Property(string name) { m_name = name; m_type = EPropertyType.EPropertyType_Object; m_value = null; }
private void EmitSetDefaultValue(ILProcessor processor, EPropertyType typeCode, ParameterDefinition param) { AppendInstructions(processor, CreateSetDefaultValue(processor, typeCode, param)); }
public static EPropertyType GetPropertyType(Type type, EPropertyType predefinedType) { return(predefinedType != EPropertyType.Unknown ? predefinedType : GetPropertyType(type)); }
private void EmitSetDefaultValue(ILProcessor processor, EPropertyType typeCode, VariableDefinition var) { AppendInstructions(processor, CreateSetDefaultValue(processor, typeCode, var)); }
public USharpPathAttribute(string path, EPropertyType propertyType) { Path = path; PropertyType = propertyType; }
private Instruction[] CreateSetDefaultValue(ILProcessor processor, EPropertyType typeCode, ParameterDefinition param) { return(CreateSetDefaultValue(processor, typeCode, param, null, null)); }
public UnrealTypeNotFoundException(EPropertyType typeCode, string typePath) : base("Failed to find path for " + typeCode + " " + typePath) { }
private Instruction[] CreateSetDefaultValue(ILProcessor processor, EPropertyType typeCode, VariableDefinition var) { return(CreateSetDefaultValue(processor, typeCode, null, null, var)); }
public static IntPtr GetPropertyClass(EPropertyType propertyType) { switch (propertyType) { case EPropertyType.Bool: return(Native_UBoolProperty.StaticClass()); case EPropertyType.Int8: return(Native_UInt8Property.StaticClass()); case EPropertyType.Int16: return(Native_UInt16Property.StaticClass()); case EPropertyType.Int: return(Native_UIntProperty.StaticClass()); case EPropertyType.Int64: return(Native_UInt64Property.StaticClass()); case EPropertyType.Byte: return(Native_UByteProperty.StaticClass()); case EPropertyType.UInt16: return(Native_UUInt16Property.StaticClass()); case EPropertyType.UInt32: return(Native_UUInt32Property.StaticClass()); case EPropertyType.UInt64: return(Native_UUInt64Property.StaticClass()); case EPropertyType.Double: return(Native_UDoubleProperty.StaticClass()); case EPropertyType.Float: return(Native_UFloatProperty.StaticClass()); case EPropertyType.Enum: return(Native_UEnumProperty.StaticClass()); case EPropertyType.Interface: return(Native_UInterfaceProperty.StaticClass()); case EPropertyType.Struct: return(Native_UStructProperty.StaticClass()); case EPropertyType.Class: return(Native_UClassProperty.StaticClass()); case EPropertyType.Object: return(Native_UObjectProperty.StaticClass()); case EPropertyType.LazyObject: return(Native_ULazyObjectProperty.StaticClass()); case EPropertyType.WeakObject: return(Native_UWeakObjectProperty.StaticClass()); case EPropertyType.SoftClass: return(Native_USoftClassProperty.StaticClass()); case EPropertyType.SoftObject: return(Native_USoftObjectProperty.StaticClass()); case EPropertyType.Delegate: return(Native_UDelegateProperty.StaticClass()); case EPropertyType.MulticastDelegate: return(Native_UMulticastDelegateProperty.StaticClass()); case EPropertyType.Array: return(Native_UArrayProperty.StaticClass()); case EPropertyType.Map: return(Native_UMapProperty.StaticClass()); case EPropertyType.Set: return(Native_USetProperty.StaticClass()); case EPropertyType.Str: return(Native_UStrProperty.StaticClass()); case EPropertyType.Name: return(Native_UNameProperty.StaticClass()); case EPropertyType.Text: return(Native_UTextProperty.StaticClass()); default: return(IntPtr.Zero); } }