Beispiel #1
0
        public FSItemInfo GetFSItemInfo(string strPath)
        {
            var fileAttributes = File.GetAttributes(strPath);
            var uFlags         = SHGFI.Icon | SHGFI.DisplayName | SHGFI.TypeName;

            uFlags |= fileAttributes.HasFlag(FileAttributes.Directory) ? SHGFI.Attributes | SHGFI.OverlayIndex : SHGFI.UseFileAttributes;

            using (var shfi = new SHFInfo())
            {
                ref readonly var fsii = ref shfi.GetSHFileInfo(strPath, 0, uFlags);
Beispiel #2
0
        public BitmapSource GetIcon(FSItemInfo itemInfo, bool isSmall = true)
        {
            var uFlags = SHGFI.Icon | (isSmall ? SHGFI.SmallIcon : SHGFI.LargeIcon);

            if (itemInfo.FileAttributes.HasFlag(FileAttributes.Directory))
            {
                if (itemInfo.Attributes.HasFlag(SFGAO.Link))
                {
                    uFlags |= SHGFI.LinkOverlay;
                }
            }
            else
            {
                uFlags |= SHGFI.UseFileAttributes;
            }


            using (var info = new SHFInfo())
            {
                ref readonly var shfl = ref info.GetSHFileInfo(itemInfo.Path, 0, uFlags);