public static PropertyState PrepareForUpdate( PropertyState state, PropertyFlags flags) { if ((flags & PropertyFlags.CanBeModified) == PropertyFlags.Ignore && state != PropertyState.Uninitialized) { //throw new CrmInvalidOperationException("Property flags indicate that property cannot be modified. Property can be modified if CanBeModified flag is set OR state is Uninitialized."); throw new InvalidOperationException("Property flags indicate that property cannot be modified. Property can be modified if CanBeModified flag is set OR state is Uninitialized."); } switch (state) { case PropertyState.Uninitialized: return(PropertyState.New); case PropertyState.Unchanged: return(PropertyState.Modified); case PropertyState.New: case PropertyState.Modified: return(state); case PropertyState.Deleted: return(PropertyState.Modified); default: //throw new CrmArgumentException(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "Unknown property state: {0}", (object)state), nameof(state)); throw new ArgumentException(string.Format((IFormatProvider)CultureInfo.InvariantCulture, "Unknown property state: {0}", (object)state), nameof(state)); } }
public IEnumerable SelectPropertyEntries( PropertyState stateMask, PropertyFlags includeFlags, PropertyFlags excludeFlags) { return((IEnumerable) new PropertyBag.EnumeratorHolder((IPropertyBagEnumerator) new PropertyBag.PropertyBagEnumerator(stateMask, includeFlags, excludeFlags, this._properties.GetEnumerator()))); }
private bool TryGetFlag(PropertyFlags flag, out bool value) { var coded = _flags & (int)flag; value = coded == (int)flag; return(coded != 0); }
internal void Reset() { this.returnType = null; this.clrTypeName = null; this.fixedDefaultValue = null; this.propertyFlags = PropertyFlags.None; }
/// <summary> /// Adds a property /// </summary> /// <param name="mapiTag">The <see cref="PropertyTag" /></param> /// <param name="obj">The value for the mapi tag</param> /// <param name="flags"> /// the flags to set on the property, default <see cref="PropertyFlags.PROPATTR_READABLE" /> /// and <see cref="PropertyFlags.PROPATTR_WRITABLE" /> /// </param> /// <exception cref="ArgumentNullException">Raised when <paramref name="obj" /> is <c>null</c></exception> internal void AddProperty(PropertyTag mapiTag, object obj, PropertyFlags flags = PropertyFlags.PROPATTR_READABLE | PropertyFlags.PROPATTR_WRITABLE) { if (obj == null) { return; } //throw new ArgumentNullException("mapiTag", "Obj can not be null"); var data = asBytes(mapiTag.Type, obj); var existingProp = this.FirstOrDefault(p => p.Id == mapiTag.Id && p.Type == mapiTag.Type); if (existingProp != null) { this.Remove(existingProp); } Add(new Property(mapiTag.Id, mapiTag.Type, flags, data)); if (isMultiValue(mapiTag.Type)) { AddMultiValueStreams(mapiTag, obj, flags); } }
/// <summary> /// Adds or sets builtProperties into the <paramref name="builtProperties"/> based on <paramref name="flags"/>. /// </summary> /// <remarks> /// This does not generate a new <see cref="Hashtable"/> because this will be called extensively based on how much a(n) <see cref="Npc"/>s /// property changes. Generating a new <see cref="Hashtable"/> everytime would be expensive. /// </remarks> public override sealed void BuildProperties(Hashtable builtProperties, PropertyFlags flags) { if (builtProperties == null) { return; } if ((flags & PropertyFlags.UnitState) == PropertyFlags.UnitState) { builtProperties[PropertyCode.UnitState] = (byte)this.State; } if ((flags & PropertyFlags.Level) == PropertyFlags.Level) { builtProperties[PropertyCode.Level] = this.Level; } if ((flags & PropertyFlags.MaxHp) == PropertyFlags.MaxHp) { builtProperties[PropertyCode.MaxHp] = this.MaximumHealth; } if ((flags & PropertyFlags.CurrHp) == PropertyFlags.CurrHp) { builtProperties[PropertyCode.CurrHp] = this.CurrentHealth; } }
protected SmartPropertyDefinition(string displayName, Type valueType, PropertyFlags flags, PropertyDefinitionConstraint[] constraints, params PropertyDependency[] dependencies) : base(PropertyTypeSpecifier.Calculated, displayName, valueType, SmartPropertyDefinition.CalculateSmartPropertyFlags(flags), constraints) { for (int i = 0; i < dependencies.Length; i++) { } this.dependencies = dependencies; this.RegisterFilterTranslation(); }
/// <summary> /// Constructs a new declaration info. /// </summary> /// <param name="name">The name of the declaration.</param> /// <param name="converter">The value converter.</param> /// <param name="flags">The property flags.</param> /// <param name="shorthands">The names of the associated shorthand declarations, if any.</param> /// <param name="longhands">The names of the associated longhand declarations, if any.</param> public DeclarationInfo(String name, IValueConverter converter, PropertyFlags flags = PropertyFlags.None, String[] shorthands = null, String[] longhands = null) { Name = name; Converter = converter; Flags = flags; Shorthands = shorthands ?? new String[0]; Longhands = longhands ?? new String[0]; }
/// <summary> /// Creates this object and sets all its propertues /// </summary> /// <param name="id">The id of the property</param> /// <param name="type">The <see cref="PropertyType" /></param> /// <param name="flags">The <see cref="PropertyFlags" /></param> /// <param name="data">The property data</param> /// <param name="multiValueIndex">if part of a multivalue property, this is the index of the value</param> internal Property(ushort id, PropertyType type, PropertyFlags flags, byte[] data, int multiValueIndex = -1) { Id = id; Type = type; Flags = Convert.ToUInt32(flags); Data = data; MultiValueIndex = multiValueIndex; }
protected void SetFlags(PropertyFlags flags) { if ((~PropertyFlags.All & flags) != PropertyFlags.Ignore) { throw new ArgumentOutOfRangeException(nameof(flags), (object)flags, "New flags combination must be a valid PropertyFlags."); } this._flags = flags; }
/// <summary> /// Creates this object and sets all its propertues /// </summary> /// <param name="id">The id of the property</param> /// <param name="type">The <see cref="PropertyType" /></param> /// <param name="flags">The <see cref="PropertyFlags" /></param> /// <param name="data">The property data</param> /// <param name="multiValue">Set to <c>true</c> to indicate that this property is part of a /// multivalue property</param> internal Property(ushort id, PropertyType type, PropertyFlags flags, byte[] data, bool multiValue = false) { Id = id; Type = type; Flags = Convert.ToUInt32(flags); Data = data; MultiValue = multiValue; }
internal CssProperty(String name, IValueConverter converter, PropertyFlags flags = PropertyFlags.None, ICssValue value = null, Boolean important = false) { _name = name.ToLowerInvariant(); _converter = converter; _flags = flags; _value = value; _important = important; }
/// <summary> /// Adds a custom property to the message or replaces it when it already exists /// </summary> /// <param name="propertyTag"><see cref="PropertyTag"/></param> /// <param name="value">The value of the property</param> /// <param name="flags"><see cref="PropertyFlags"/></param> /// <exception cref="MKMessageSaved">Raised when the mesage has already been saved with the Save method</exception> public void AddProperty(PropertyTag propertyTag, object value, PropertyFlags flags = PropertyFlags.PROPATTR_WRITABLE) { if (_saved) { throw new MKMessageSaved("The message can't be modified when it already has been saved"); } TopLevelProperties.AddOrReplaceProperty(propertyTag, value, flags); }
internal PropertyRow( PropertyFlags flags, uint name, uint signature) { this.Flags = flags; this.Name = name; this.Signature = signature; }
/// <summary> /// Adds a property that has been read from the propertiesstream /// </summary> /// <param name="id">The id of the property</param> /// <param name="type">The <see cref="PropertyType" /></param> /// <param name="data"></param> /// <param name="flags"> /// the flags to set on the property, default <see cref="PropertyFlags.PROPATTR_READABLE" /> /// and <see cref="PropertyFlags.PROPATTR_WRITABLE" /> /// </param> /// <exception cref="ArgumentOutOfRangeException">Raised when <paramref name="data" /> is not 8 bytes</exception> internal void AddProperty(ushort id, PropertyType type, byte[] data, PropertyFlags flags = PropertyFlags.PROPATTR_READABLE& PropertyFlags.PROPATTR_WRITABLE) { if (data.Length != 8) { throw new ArgumentOutOfRangeException(nameof(data), "The data should always have an 8 byte size"); } Add(new Property(id, type, flags, data)); }
private static PropertyFlags CalculatePropertyTagPropertyFlags(PropTag propertyTag, PropertyFlags userFlags) { PropertyFlags propertyFlags = userFlags & (PropertyFlags)(-2147418113); if (propertyTag.IsTransmittable()) { propertyFlags |= PropertyFlags.Transmittable; } return(propertyFlags); }
public override PropertyFlags GetFlags() { PropertyFlags flags = base.GetFlags(); if (InType.Name == WinEventSchema.SecurityId) { flags &= ~(PropertyFlags.FixedLength); } return(flags); }
/// <summary> /// Creates a new property, given the /// </summary> /// <param name="key">The unique key for the property.</param> /// <param name="type">The <see cref="IType"/> of data stored in the property.</param> /// <param name="flags">Optionally, a new property can specify specific flags to be set that control how the memory can be accessed. For more information, see <seealso cref="PropertyFlags"/>.</param> public MemoryProperty(string key, IType type, PropertyFlags flags = DefaultFlags) { Key = key; Type = type; if (Type == null) { throw new ArgumentException("The type parameter of a MemoryProperty is required and cannot be null."); } Flags = flags; }
private static PropertyFlags CalculatePropertyTagPropertyFlags(string propertyName, Guid guid, PropertyFlags userFlags, bool isCustom) { PropertyFlags propertyFlags = NativeStorePropertyDefinition.CalculatePropertyTagPropertyFlags(userFlags, isCustom); if (guid == WellKnownPropertySet.InternetHeaders && MimeConstants.IsInReservedHeaderNamespace(propertyName)) { propertyFlags &= ~PropertyFlags.Transmittable; } return(propertyFlags); }
protected static PropertyFlags CalculatePropertyTagPropertyFlags(PropertyFlags userFlags, bool isCustom) { PropertyFlags propertyFlags = userFlags & (PropertyFlags)(-2147418113); if (isCustom) { propertyFlags |= PropertyFlags.Custom; } return(propertyFlags | PropertyFlags.Transmittable); }
internal ModelVariantStateBlockBase(BinaryReader binaryReader) { this.permutationName = binaryReader.ReadStringID(); this.invalidName_ = binaryReader.ReadBytes(1); this.propertyFlags = (PropertyFlags)binaryReader.ReadByte(); this.state = (State)binaryReader.ReadInt16(); this.loopingEffect = binaryReader.ReadTagReference(); this.loopingEffectMarkerName = binaryReader.ReadStringID(); this.initialProbability = binaryReader.ReadSingle(); }
public PropertyBagEnumerator( PropertyState stateMask, PropertyFlags includeFlags, PropertyFlags excludeFlags, IDictionaryEnumerator baseEnumerator) { this._stateMask = stateMask; this._includeFlags = includeFlags; this._excludeFlags = excludeFlags; this._baseEnumerator = baseEnumerator; }
/// <summary> /// Gets the current up-to-date builtProperties. This never generates a new <see cref="Hashtable"/>. /// </summary> public Hashtable GetProperties() { if (DirtyProperties != PropertyFlags.None) { // updates the current builtProperties with any changed builtProperties this.BuildProperties(properties, this.DirtyProperties); this.DirtyProperties = PropertyFlags.None; } return(this.properties); }
/// <summary> /// Constructs a new declaration info. /// </summary> /// <param name="name">The name of the declaration.</param> /// <param name="converter">The value converter.</param> /// <param name="flags">The property flags.</param> /// <param name="initialValue">The initial value, if any.</param> /// <param name="shorthands">The names of the associated shorthand declarations, if any.</param> /// <param name="longhands">The names of the associated longhand declarations, if any.</param> public DeclarationInfo(String name, IValueConverter converter, PropertyFlags flags = PropertyFlags.None, ICssValue initialValue = null, String[] shorthands = null, String[] longhands = null) { Name = name; Converter = initialValue != null?Or(converter, AssignInitial(initialValue)) : converter; Aggregator = converter as IValueAggregator; Flags = flags; InitialValue = initialValue; Shorthands = shorthands ?? Array.Empty <String>(); Longhands = longhands ?? Array.Empty <String>(); }
public override System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> ReadFields(System.IO.BinaryReader binaryReader) { System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer> pointerQueue = new System.Collections.Generic.Queue <Moonfish.Tags.BlamPointer>(base.ReadFields(binaryReader)); this.PermutationName = binaryReader.ReadStringID(); this.fieldpad = binaryReader.ReadBytes(1); this.ModelVariantStatePropertyFlags = ((PropertyFlags)(binaryReader.ReadByte())); this.State = ((StateEnum)(binaryReader.ReadInt16())); this.LoopingEffect = binaryReader.ReadTagReference(); this.LoopingEffectMarkerName = binaryReader.ReadStringID(); this.InitialProbability = binaryReader.ReadSingle(); return(pointerQueue); }
public static ObjectProperty Register( PropertyBag bag, string propertyName, object initialValue, PropertyState state, PropertyFlags flags) { ObjectProperty objectProperty = new ObjectProperty(state, flags, initialValue); bag.Add(propertyName, (IProperty)objectProperty); return(objectProperty); }
private static void CheckAndAddProperty(string name, StorePropertyDefinition property, PropertyChangeMetadata.PropertyGroup propertyGroup, int index) { if (propertyGroup.IsBitField) { PropertyFlags propertyFlags = propertyGroup.ContainerStoreProperty.PropertyFlags; } PropertyChangeMetadata.PropertyNameToPropertyAndIndex.Add(name, new PropertyChangeMetadata.PropertyAndIndex { Property = property, Index = index }); }
private void SetFlag(bool value, PropertyFlags flag) { if (value) { _flags |= (int)flag; } else { var falseValue = ((int)flag << 1) & (int)flag; _flags = (_flags & ~(int)flag) | falseValue; } }
/// <summary> /// Adds a property when it not exists, otherwise it is replaced /// </summary> /// <param name="mapiTag">The <see cref="PropertyTag" /></param> /// <param name="obj">The value for the mapi tag</param> /// <param name="flags"> /// the flags to set on the property, default <see cref="PropertyFlags.PROPATTR_READABLE" /> /// and <see cref="PropertyFlags.PROPATTR_WRITABLE" /> /// </param> /// <exception cref="ArgumentNullException">Raised when <paramref name="obj" /> is <c>null</c></exception> internal void AddOrReplaceProperty(PropertyTag mapiTag, object obj, PropertyFlags flags = PropertyFlags.PROPATTR_READABLE | PropertyFlags.PROPATTR_WRITABLE) { var index = FindIndex(m => m.Id == mapiTag.Id); if (index >= 0) { RemoveAt(index); } AddProperty(mapiTag, obj, flags); }
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ internal ObjectProperty(object target, string keyName, string label = null, PropertyFlags flags = PropertyFlags.None, object min = null, object max = null) { this.target = target; this.label = label != null ? label:keyName; this.keyName = keyName; field = target.GetType().GetField(keyName); if (field == null) { prop = target.GetType().GetProperty(keyName); } this.flags = flags; this.min = min; this.max = max; }
protected PropertySpec(ITypeResolver typeResolver, PropertyInfo propertyInfo, Func<TypeSpec> reflectedType = null) : base(typeResolver, propertyInfo) { this.reflectedType = CreateLazy(reflectedType ?? (() => typeResolver.LoadReflectedType(this))); this.declaringType = CreateLazy(() => typeResolver.LoadDeclaringType(this)); this.propertyType = CreateLazy(() => typeResolver.LoadPropertyType(this)); this.propertyFlags = typeResolver.LoadPropertyFlags(this); this.baseDefinition = CreateLazy(() => typeResolver.LoadBaseDefinition(this)); this.getter = CreateLazy(() => typeResolver.LoadGetter(this)); this.setter = CreateLazy(() => typeResolver.LoadSetter(this)); this.isRequiredForConstructor = CreateLazy(() => ReflectedType.RequiredProperties.Contains(this)); }
public override bool Deserialize() { var result = base.Deserialize(); var ArrayInfo = Data.ReadInt32(); ArraySize = (UInt16)(ArrayInfo & 0x0000FFFFU); ArrayElementSize = (UInt16)(ArrayInfo >> 16); PropertyFlags = (PropertyFlags)Data.ReadUInt64(); if (PropertyFlags.HasFlag(PropertyFlags.Net)) ReplicateOffset = Data.ReadUInt16(); _CategoryNameRef = Data.ReadNameRef(); Category = PCC.GetName(_CategoryNameRef); ReplicateOffset = Data.ReadUInt16(); // TODO: verify, see code ReplicateIndex = Data.ReadUInt16(); return result; }
/// <summary>The set command.</summary> public void SetCommand() { try { bool commandChanged = _changedFlags.HasFlag(PropertyFlags.Command); bool customNameChanged = _changedFlags.HasFlag(PropertyFlags.CustomName); if (customNameChanged) { var dependencyObject = Target.TypedTarget(); if (dependencyObject != null) { Type tarType = dependencyObject.GetType(); _prop = tarType.GetProperty(CustomName); if (_prop != null && (!_prop.CanWrite || !typeof (ICommand).IsAssignableFrom(_prop.PropertyType))) { string typeName = tarType.ToString(); string propName = _prop == null ? CustomName + "(Not Found)" : _prop.Name; CommonWpfConstans.LogCommon(false, "CommandBinder: FoundetProperty Incompatible: {0}:{1}", typeName, propName); _prop = null; } else commandChanged = true; } } if (commandChanged && _prop != null) _prop.SetValue(Target.TypedTarget(), Command, null); } finally { _changedFlags = PropertyFlags.None; } }
private bool TryGetFlag(PropertyFlags flag, out bool value) { var coded = _flags & (int)flag; value = coded == (int)flag; return coded != 0; }
public CssShorthandProperty(String name, PropertyFlags flags = PropertyFlags.None) : base(name, flags | PropertyFlags.Shorthand) { }
public StudioPropertyAttribute(string category) { this.m_fPropertyFlags = PropertyFlags.Browsable; this.m_Category = category; }
public StudioPropertyAttribute(PropertyFlags flags, string category) { this.m_fPropertyFlags = flags; this.m_Category = category; }
private bool GetRequiredFlag(PropertyFlags flag) => (_flags & flag) != 0;
private void SetRequiredFlag(bool value, PropertyFlags flag) { _flags = value ? (_flags | flag) : (_flags & ~flag); }
public Property(TypeNode declaringType, AttributeList attributes, PropertyFlags flags, Identifier name, Method getter, Method setter) : base(declaringType, attributes, name, NodeType.Property) { this.flags = flags; this.getter = getter; this.setter = setter; if(getter != null) getter.DeclaringMember = this; if(setter != null) setter.DeclaringMember = this; }
public PropertyStateFlagsAttribute(PropertyFlags flags) { mFlags = flags; }
/// <summary> /// Creates a new CSS property. /// </summary> /// <param name="name">The name of the property</param> /// <param name="flags">The property flags, if any.</param> internal CssProperty(String name, PropertyFlags flags = PropertyFlags.None) { _name = name; _flags = flags; }
// Methods public StudioPropertyAttribute(PropertyFlags flags) { this.m_Category = null; this.m_fPropertyFlags = flags; }
private bool? GetFlag(PropertyFlags flag) => (_setFlags & flag) != 0 ? (_flags & flag) != 0 : (bool?)null;
/// <summary> /// Creates a new mapping for a property /// </summary> /// <param name="name">Name of the property</param> /// <param name="columnName">Column this property is mapped to</param> /// <param name="flags">Flags specifying behavior for the column</param> public DataProperty(string name, string columnName, PropertyFlags flags) { Name = name; ColumnName = columnName; Flags = flags; }
private void SetFlag(bool? value, PropertyFlags flag) { _setFlags = value.HasValue ? (_setFlags | flag) : (_setFlags & ~flag); _flags = value.HasValue && value.Value ? (_flags | flag) : (_flags & ~flag); }
/// <summary> /// Creates a mapping for a property /// </summary> /// <param name="name"></param> /// <param name="flags"></param> public DataProperty(string name, PropertyFlags flags) : this(name, name, flags) { }
internal ClrPropertyInfo( string propertyName, string propertyNs, string schemaName, Occurs occursInSchema) { this.contentType = ContentType.Property; this.propertyName = propertyName; this.propertyNs = propertyNs; this.schemaName = schemaName; this.hasSet = true; this.returnType = null; this.clrTypeName = null; this.occursInSchema = occursInSchema; if (this.occursInSchema > Occurs.ZeroOrOne) { this.propertyFlags |= PropertyFlags.IsList; } if (this.IsOptional) { this.propertyFlags |= PropertyFlags.IsNullable; } XNameGetExpression(); }
public ModelVariantStateBlock(BinaryReader binaryReader) { this.permutationName = binaryReader.ReadStringID(); this.padding = binaryReader.ReadByte(); this.propertyFlags = (PropertyFlags)binaryReader.ReadByte(); this.state = (State)binaryReader.ReadInt16(); this.loopingEffectPlayedWhileTheModelIsInThisState = binaryReader.ReadTagReference(); this.loopingEffectMarkerName = binaryReader.ReadStringID(); this.initialProbability = binaryReader.ReadSingle(); }
void AddProperty(List<uint> array, string name, string type, PropertyFlags flags) { array.Add(handler(name)); array.Add(handler(type)); array.Add((uint)flags); }
/// <summary> /// Initializes a new instance of the <see cref="PropertySearcher" /> class. /// Initialisiert eine neue Instanz der <see cref="PropertySearcher" /> Klasse. /// </summary> /// <param name="target"> /// The target. /// </param> /// <param name="customName"> /// The custom name. /// </param> /// <param name="command"> /// The command. /// </param> public PropertySearcher([NotNull] WeakReference<DependencyObject> target, [NotNull] string customName, [NotNull] ICommand command) { Contract.Requires<ArgumentNullException>(target != null, "target"); Contract.Requires<ArgumentNullException>(customName != null, "customName"); Contract.Requires<ArgumentNullException>(command != null, "command"); Target = target; CustomName = customName; Command = command; _changedFlags = PropertyFlags.All; }