Exemple #1
0
 /// <summary>
 /// Constructs a new Property object
 /// </summary>
 /// <param name="propertyKey"></param>
 /// <param name="description"></param>
 /// <param name="propertyStore"></param>
 public ShellProperty(
     PropertyKey propertyKey,
     ShellPropertyDescription description,
     IPropertyStore propertyStore)
 {
     this.propertyKey       = propertyKey;
     this.description       = description;
     NativePropertyStore    = propertyStore;
     AllowSetTruncatedValue = false;
 }
Exemple #2
0
 /// <summary>
 /// Constructs a new Property object
 /// </summary>
 /// <param name="propertyKey"></param>
 /// <param name="description"></param>
 /// <param name="parent"></param>
 public ShellProperty(
     PropertyKey propertyKey,
     ShellPropertyDescription description,
     ShellObject parent)
 {
     this.propertyKey       = propertyKey;
     this.description       = description;
     ParentShellObject      = parent;
     AllowSetTruncatedValue = false;
 }
Exemple #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);

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

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

            switch (desc.VarEnumType)
            {
            case (VarEnum.VT_EMPTY):
            case (VarEnum.VT_NULL):
            {
                return(new ShellProperty <Object>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_UI1):
            {
                return(new ShellProperty <Byte?>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_I2):
            {
                return(new ShellProperty <Int16?>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_UI2):
            {
                return(new ShellProperty <UInt16?>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_I4):
            {
                return(new ShellProperty <Int32?>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_UI4):
            {
                return(new ShellProperty <UInt32?>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_I8):
            {
                return(new ShellProperty <Int64?>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_UI8):
            {
                return(new ShellProperty <UInt64?>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_R8):
            {
                return(new ShellProperty <Double?>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_BOOL):
            {
                return(new ShellProperty <Boolean?>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_FILETIME):
            {
                return(new ShellProperty <DateTime?>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_CLSID):
            {
                return(new ShellProperty <IntPtr?>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_CF):
            {
                return(new ShellProperty <IntPtr?>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_BLOB):
            {
                return(new ShellProperty <Byte[]>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_LPWSTR):
            {
                return(new ShellProperty <String>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_UNKNOWN):
            {
                return(new ShellProperty <IntPtr?>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_STREAM):
            {
                return(new ShellProperty <IStream>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_VECTOR | VarEnum.VT_UI1):
            {
                return(new ShellProperty <Byte[]>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_VECTOR | VarEnum.VT_I2):
            {
                return(new ShellProperty <Int16[]>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_VECTOR | VarEnum.VT_UI2):
            {
                return(new ShellProperty <UInt16[]>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_VECTOR | VarEnum.VT_I4):
            {
                return(new ShellProperty <Int32[]>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_VECTOR | VarEnum.VT_UI4):
            {
                return(new ShellProperty <UInt32[]>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_VECTOR | VarEnum.VT_I8):
            {
                return(new ShellProperty <Int64[]>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_VECTOR | VarEnum.VT_UI8):
            {
                return(new ShellProperty <UInt64[]>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_VECTOR | VarEnum.VT_R8):
            {
                return(new ShellProperty <Double[]>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_VECTOR | VarEnum.VT_BOOL):
            {
                return(new ShellProperty <Boolean[]>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_VECTOR | VarEnum.VT_FILETIME):
            {
                return(new ShellProperty <DateTime[]>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_VECTOR | VarEnum.VT_CLSID):
            {
                return(new ShellProperty <IntPtr[]>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_VECTOR | VarEnum.VT_CF):
            {
                return(new ShellProperty <IntPtr[]>(propKey, desc, ParentShellObject));
            }

            case (VarEnum.VT_VECTOR | VarEnum.VT_LPWSTR):
            {
                return(new ShellProperty <String[]>(propKey, desc, ParentShellObject));
            }

            default:
            {
                return(new ShellProperty <Object>(propKey, desc, ParentShellObject));
            }
            }
        }
Exemple #5
0
        internal IShellProperty CreateTypedProperty <T>(PropertyKey propKey)
        {
            ShellPropertyDescription desc = ShellPropertyDescriptionsCache.Cache.GetPropertyDescription(propKey);

            return(new ShellProperty <T>(propKey, desc, ParentShellObject));
        }
 private static void ShowPropertyInfo(string propertyName, ShellPropertyDescription propDesc)
 {
     Console.WriteLine("\nProperty {0}", propDesc.CanonicalName);
     Console.WriteLine("\tPropertyKey: {0}, {1}", propDesc.PropertyKey.FormatId.ToString("B"), propDesc.PropertyKey.PropertyId);
     Console.WriteLine("\tLabel:  {0}", propDesc.DisplayName);
     Console.WriteLine("\tEdit Invitation:  {0}", propDesc.EditInvitation);
     Console.WriteLine("\tDisplay Type:  {0}", propDesc.DisplayType);
     Console.WriteLine("\tVar Enum Type:  {0}", propDesc.VarEnumType);
     Console.WriteLine("\tValue Type:  {0}", propDesc.ValueType);
     Console.WriteLine("\tDefault Column Width:  {0}", propDesc.DefaultColumWidth);
     Console.WriteLine("\tAggregation Type:  {0}", propDesc.AggregationTypes);
     Console.WriteLine("\tHas Multiple Values:  {0}", (propDesc.TypeFlags & PropertyTypeFlags.MultipleValues) == PropertyTypeFlags.MultipleValues);
     Console.WriteLine("\tIs Group:  {0}", (propDesc.TypeFlags & PropertyTypeFlags.IsGroup) == PropertyTypeFlags.IsGroup);
     Console.WriteLine("\tIs Innate:  {0}", (propDesc.TypeFlags & PropertyTypeFlags.IsInnate) == PropertyTypeFlags.IsInnate);
     Console.WriteLine("\tIs Queryable:  {0}", (propDesc.TypeFlags & PropertyTypeFlags.IsQueryable) == PropertyTypeFlags.IsQueryable);
     Console.WriteLine("\tIs Viewable:  {0}", (propDesc.TypeFlags & PropertyTypeFlags.IsViewable) == PropertyTypeFlags.IsViewable);
     Console.WriteLine("\tIs SystemProperty:  {0}", (propDesc.TypeFlags & PropertyTypeFlags.IsSystemProperty) == PropertyTypeFlags.IsSystemProperty);
 }