Example #1
0
 /// <summary>
 /// Constructs a new Property object
 /// </summary>
 /// <param name="propertyKey"></param>
 /// <param name="description"></param>
 /// <param name="propertyStore"></param>
 internal ShellProperty(
     PropertyKey propertyKey,
     ShellPropertyDescription description,
     IPropertyStore propertyStore)
 {
     this.propertyKey       = propertyKey;
     this.description       = description;
     NativePropertyStore    = propertyStore;
     AllowSetTruncatedValue = false;
 }
Example #2
0
 /// <summary>
 /// Constructs a new Property object
 /// </summary>
 /// <param name="propertyKey"></param>
 /// <param name="description"></param>
 /// <param name="parent"></param>
 internal ShellProperty(
     PropertyKey propertyKey,
     ShellPropertyDescription description,
     ShellObject parent)
 {
     this.propertyKey       = propertyKey;
     this.description       = description;
     ParentShellObject      = parent;
     AllowSetTruncatedValue = false;
 }
Example #3
0
        private static IShellProperty GenericCreateShellProperty <T>(PropertyKey propKey, T thirdArg)
        {
            Type thirdType = (thirdArg is ShellObject) ? typeof(ShellObject) : typeof(T);

            ShellPropertyDescription propDesc = ShellPropertyDescriptionsCache.Cache.GetPropertyDescription(propKey);

            // Get the generic type
            Type type = typeof(ShellProperty <>).MakeGenericType(VarEnumToSystemType(propDesc.VarEnumType));

            // The hash for the function is based off the generic type and which type (constructor) we're using.
            int hash = GetTypeHash(type, thirdType);

            Func <PropertyKey, ShellPropertyDescription, object, IShellProperty> ctor;

            if (!_storeCache.TryGetValue(hash, out ctor))
            {
                Type[] argTypes = { typeof(PropertyKey), typeof(ShellPropertyDescription), thirdType };
                ctor = ExpressConstructor(type, argTypes);
                _storeCache.Add(hash, ctor);
            }

            return(ctor(propKey, propDesc, thirdArg));
        }
Example #4
0
        internal IShellProperty CreateTypedProperty <T>(PropertyKey propKey)
        {
            ShellPropertyDescription desc = ShellPropertyDescriptionsCache.Cache.GetPropertyDescription(propKey);

            return(new ShellProperty <T>(propKey, desc, ParentShellObject));
        }