/// <summary>
        /// Determines whether an overlay should be shown for the shell item with the path 'path' and
        /// the shell attributes 'attributes'.
        /// </summary>
        /// <param name="path">The path for the shell item. This is not necessarily the path
        /// to a physical file or folder.</param>
        /// <param name="attributes">The attributes of the shell item.</param>
        /// <returns>
        ///   <c>true</c> if this an overlay should be shown for the specified item; otherwise, <c>false</c>.
        /// </returns>
        protected override bool CanShowOverlay(string path, SFGAO attributes)
        {
            //  We are going to show the overlay only for read only files.
            if (attributes.HasFlag(SFGAO.SFGAO_FILESYSTEM) == false || attributes.HasFlag(SFGAO.SFGAO_FOLDER)
                || attributes.HasFlag(SFGAO.SFGAO_STREAM))
                return false;

            //  Get the file attributes.
            var fileAttributes = new FileInfo(path);

            //  Return true if the file is read only, meaning we'll show the overlay.
            return fileAttributes.IsReadOnly;
        }
        /// <summary>
        /// Determines whether an overlay should be shown for the shell item with the path 'path' and
        /// the shell attributes 'attributes'.
        /// </summary>
        /// <param name="path">The path for the shell item. This is not necessarily the path
        /// to a physical file or folder.</param>
        /// <param name="attributes">The attributes of the shell item.</param>
        /// <returns>
        ///   <c>true</c> if this an overlay should be shown for the specified item; otherwise, <c>false</c>.
        /// </returns>
        protected override bool CanShowOverlay(string path, SFGAO attributes)
        {
            //  We are going to show the overlay only for read only files.
            if (attributes.HasFlag(SFGAO.SFGAO_FILESYSTEM) == false || attributes.HasFlag(SFGAO.SFGAO_FOLDER) ||
                attributes.HasFlag(SFGAO.SFGAO_STREAM))
            {
                return(false);
            }

            //  Get the file attributes.
            var fileAttributes = new FileInfo(path);

            //  Return true if the file is read only, meaning we'll show the overlay.
            return(fileAttributes.IsReadOnly);
        }
Ejemplo n.º 3
0
 private static void UpdateFlagIfSet(ref SFGAO sfgao, SFGAO flag, bool set)
 {
     if (sfgao.HasFlag(flag))
     {
         if (set == false)
         {
             sfgao ^= flag;
         }
     }
 }
Ejemplo n.º 4
0
 private static void UpdateFlagIfSet(ref SFGAO sfgao, SFGAO flag, bool set)
 {
     if (sfgao.HasFlag(flag))
     {
         if (set == false)
             sfgao ^= flag;
     }
 }