修改获取磁盘图标 及 快捷名称获取

This commit is contained in:
liufei
2021-12-22 18:01:29 +08:00
parent 353acec75e
commit 7f585dd095
4 changed files with 18 additions and 4 deletions

File diff suppressed because one or more lines are too long

View File

@@ -212,8 +212,9 @@ namespace GeekDesk.Control.UserControls.PannelCard
foreach (object obj in dropObject) foreach (object obj in dropObject)
{ {
string path = (string)obj; string path = (string)obj;
string tempPath = path;
//string base64 = ImageUtil.FileImageToBase64(path, ImageFormat.Png); //string base64 = ImageUtil.FileImageToBase64(path, System.Drawing.Imaging.ImageFormat.Png);
string ext = ""; string ext = "";
if (!ImageUtil.IsSystemItem(path)) if (!ImageUtil.IsSystemItem(path))
{ {
@@ -236,7 +237,7 @@ namespace GeekDesk.Control.UserControls.PannelCard
BitmapImage = bi BitmapImage = bi
}; };
iconInfo.DefaultImage = iconInfo.ImageByteArr; iconInfo.DefaultImage = iconInfo.ImageByteArr;
iconInfo.Name = System.IO.Path.GetFileNameWithoutExtension(path); iconInfo.Name = System.IO.Path.GetFileNameWithoutExtension(tempPath);
if (StringUtil.IsEmpty(iconInfo.Name)) if (StringUtil.IsEmpty(iconInfo.Name))
{ {
iconInfo.Name = path; iconInfo.Name = path;

View File

@@ -27,6 +27,7 @@
<WarningLevel>4</WarningLevel> <WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Prefer32Bit>false</Prefer32Bit> <Prefer32Bit>false</Prefer32Bit>
<GenerateSerializationAssemblies>Auto</GenerateSerializationAssemblies>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>

View File

@@ -96,9 +96,18 @@ namespace GeekDesk.Util
return FileIcon.GetBitmapImage(filePath); return FileIcon.GetBitmapImage(filePath);
} }
} else if(Directory.Exists(filePath)) { } else if(Directory.Exists(filePath)) {
if ((filePath.IndexOf("\\") == filePath.LastIndexOf("\\")) && filePath.IndexOf("\\") == filePath.Length - 1)
{
//磁盘
return ImageUtil.Base64ToBitmapImage(Constants.DEFAULT_DISK_IMAGE_BASE64);
} else
{
//文件夹 //文件夹
return ImageUtil.Base64ToBitmapImage(Constants.DEFAULT_DIR_IMAGE_BASE64); return ImageUtil.Base64ToBitmapImage(Constants.DEFAULT_DIR_IMAGE_BASE64);
} }
}
return null; return null;
} }