Our application has a file format similar to the OpenDocument file format (see http://en.wikipedia.org/wiki/OpenDocument) - i.e. zipped with a manifest file, a thumbnail image, etc.
我们的应用程序具有类似于OpenDocument文件格式的文件格式(请参阅http://en.wikipedia.org/wiki/OpenDocument) - 即使用清单文件,缩略图图像等进行压缩。
I notice that OpenOffice files have a preview image of the Open Office file as their icons, both in Windows and in Linux. Is there some way to accomplish this for our files: i.e. I want a dynamic icon based on the internal thumbnail.png?
我注意到OpenOffice文件在Windows和Linux中都有Open Office文件的预览图像作为图标。有没有办法为我们的文件实现这一点:即我想要一个基于内部thumbnail.png的动态图标?
Edit 1 Wow, thanks for all the quick answers. Thumbnailer looks great for the GNOME world. Windows I'll be looking into those links, thanks. As for the comment question: programmatically OR via our installer.
编辑1哇,谢谢你所有的快速答案。 Thumbnailer看起来非常适合GNOME世界。 Windows我会查看这些链接,谢谢。至于评论问题:通过我们的安装程序以编程方式OR。
Edit 2 Oh, forgot Mac. How about on the Mac? (Sorry Mac lovers!) Also are there any links or info for how OpenOffice does their IconHandler stuff - since ours would be very similar?
编辑2哦,忘了Mac。在Mac上怎么样? (对不起Mac爱好者!)还有任何关于OpenOffice如何处理他们的IconHandler内容的链接或信息 - 因为我们的非常相似吗?
9 个解决方案
#1
8
Windows
What you need is an Icon Handler, also known as a Thumbnail Handler. Here is an example written as an active x control.
你需要的是一个Icon Handler,也称为Thumbnail Handler。这是一个写为活动x控件的示例。
Another resource is to look up Property Handlers, which should also point to you to the latest and greatest way of having dynamic meta data handled correctly in windows.
另一个资源是查找属性处理程序,它还应该指向您在Windows中正确处理动态元数据的最新和最好的方法。
These are dynamic solutions - they aren't needed if you just want an icon associated with all your files - they are only used when you want windows explorer to display an icon based on what's in the file, not just the extension, and when the file changes the icon is updated to reflect the changes. It doesn't have to be an image of the file itself, either, the thumbnail handler can generate any image based on the file contents.
这些是动态解决方案 - 如果您只想要一个与所有文件相关联的图标,则不需要它们 - 只有当您希望Windows资源管理器根据文件中的内容(而不仅仅是扩展名)显示图标时才使用它们。文件更改图标已更新以反映更改。它不必是文件本身的图像,缩略图处理程序也可以根据文件内容生成任何图像。
The property handler updates other metadata, such as song or video length, so you can use all the metadata Windows Explorer supports.
属性处理程序更新其他元数据,例如歌曲或视频长度,因此您可以使用Windows资源管理器支持的所有元数据。
Regarding MAC support, this page says, "The Mac and Windows operating systems have different methods of enabling this type of thumbnail, and in the case of the Mac OS, this support has been inconsistent from version to version so it hasn't been pursued [for Adobe InDesign]."
关于MAC支持,这个页面说,“Mac和Windows操作系统有不同的方法来启用这种类型的缩略图,而在Mac OS的情况下,这种支持在版本之间是不一致的,所以它没有被追求[适用于Adobe InDesign]。“
OS X
Icons for Mac OSX are determined by the Launch Services Database. However, it refers to a static icon file for all files handled by a registered application (it's not based on extension - each file has meta data attached that determines the application to which it belongs, although extensions give hints when the meta data doesn't exist, such as getting the file from a different OS or file system)
Mac OSX的图标由启动服务数据库确定。但是,它指的是由注册应用程序处理的所有文件的静态图标文件(它不是基于扩展名 - 每个文件都附加了元数据,用于确定它所属的应用程序,尽管扩展在元数据不提供时提供提示存在,例如从不同的OS或文件系统获取文件)
It appears that the dynamic icon functionality in OSX is provided by Finder, but searches aren't bringing up any easy pointers in this direction. Since Finder keeps changing over time, I can see why this target is hard to hit...
OSX中的动态图标功能似乎是由Finder提供的,但搜索并没有在这个方向上提出任何简单的指针。由于Finder不断变化,我可以看出为什么这个目标很难被击中...
Gnome
For Gnome you use a thumbnailer. (thanks Dorward)
对于Gnome,你使用缩略图。 (感谢Dorward)
This is an extraordinarily simple program you write, which has 3 command line arguments:
这是一个非常简单的程序,它有3个命令行参数:
- input file name, the file you are describing with the thumbnail (or URI if you accept those instead)
- output file name, where you need to write the PNG
- size, a number, in pixels, that describes the maximum square image size you should produce (128 --> 128x128 or smaller)
输入文件名,用缩略图描述的文件(如果接受,则为URI)
输出文件名,您需要在其中编写PNG
size,一个数字,以像素为单位,描述您应该生成的最大方形图像大小(128 - > 128x128或更小)
I wish all systems were this simple. On the other hand this doesn't support animation and a few other features that are provided by more difficult to implement plugins on other systems.
我希望所有系统都这么简单。另一方面,这不支持动画和其他系统上更难实现的插件提供的一些其他功能。
KDE
I'm a bit uncertain, but there are a few pointers that should get you started. First is that Konqueror is the file manager and displays the icons - it supports dynamic icons for some inbuilt types, but I don't know if these are hardcoded, or plugins you can write. Check out the Embedded Components Tutorial for a starting point.
我有点不确定,但有一些指针应该让你开始。首先是Konqueror是文件管理器并显示图标 - 它支持一些内置类型的动态图标,但我不知道这些是硬编码还是可以编写的插件。查看嵌入式组件教程了解起点。
There's a new (ish?) feature (or planned feature...) called Plasma which has a great deal to do with icons and icon functionality. Check out this announcment and this initial implementation.
有一个名为Plasma的新(ish?)功能(或计划功能......),它与图标和图标功能有很大关系。看看这个公告和这个初步实现。
You may need to dig into the source of Konqueror and check out how they did this for text files and others already implemented.
您可能需要深入了解Konqueror的来源,并查看他们如何为文本文件和其他已实现的文件执行此操作。
-Adam
#2
4
Mac OSX since version 10.5 …
… has two approaches:
......有两种方法:
-
Your document is in the standard OSX bundle format and has a static image This can be done by creating a subfolder QuickLook and placing the Thumbnail/Preview.png/tiff/jpg inside.
您的文档采用标准OSX包格式并具有静态图像这可以通过创建子文件夹QuickLook并将Thumbnail / Preview.png / tiff / jpg放在其中来完成。
-
Everything else needs a QuickLook generator plugin which can be stored in either /Library/QuickLook ~/Library/QuickLook or inside the YourApp.app/Contents/Library/QuickLook Folders.
其他所有东西都需要一个QuickLook生成器插件,可以存储在/ Library / QuickLook~ / Library / QuickLook或YourApp.app/Contents/Library/QuickLook文件夹中。
This generator is being used to create Thumbnails and QuickLook previews on the fly. XCode offers a template for this. The template generates the needed ANSI C files which have to be implemented. If you want to write Object-C code you have to rename the GenerateThumbnailForURL.c and GeneratePreviewForURL.c to GenerateThumbnailForURL.m and GeneratePreviewForURL.m (and read the Apple Devel Docs carefully ;) )
此生成器用于动态创建缩略图和QuickLook预览。 XCode为此提供了一个模板。该模板生成必须实现的所需ANSI C文件。如果要编写Object-C代码,则必须将GenerateThumbnailForURL.c和GeneratePreviewForURL.c重命名为GenerateThumbnailForURL.m和GeneratePreviewForURL.m(并仔细阅读Apple Devel Docs;))
Simple zip container based demo:
You will have to add the Cocoa.framework and Foundation.framework to your project In your GenerateThumbnailForURL.c (this is partly out of my head - so no guarantee that it works out of the box ;) ):
你必须将Cocoa.framework和Foundation.framework添加到你的项目中你的GenerateThumbnailForURL.c(这部分不在我的脑海里 - 所以不能保证它开箱即用;)):
#include <Cocoa/Cocoa.h>
#include <Foundation/Foundation.h>
OSStatus GenerateThumbnailForURL(void *thisInterface, QLThumbnailRequestRef thumbnail, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options, CGSize maxSize)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
/* unzip the thumbnail and put it into an NSData object */
// Create temporary path and writing handle for extraction
NSString *tmpPath = [NSTemporaryDirectory() stringByAppendingFormat: [NSString stringWithFormat: @"%.0f.%@" , [NSDate timeIntervalSinceReferenceDate] * 1000.0, @"png"]];
[[NSFileManager defaultManager] createFileAtPath: tmpPath contents: [NSData alloc] attributes:nil];
NSFileHandle *writingHandle = [NSFileHandle fileHandleForWritingAtPath: tmpPath];
// Use task to unzip - create command: /usr/bin/unzip -p <pathToFile> <fileToExtract>
NSTask *unzipTask = [[NSTask alloc] init];
[unzipTask setLaunchPath: @"/usr/bin/unzip"];
// -p -> output to StandardOut, added File to extract, nil to terminate Array
[unzipTask setArguments: [NSArray arrayWithObjects: @"-p", [(NSURL *) url path], @"Thumbnails/thumbnail.png", nil]];
// redirect standardOut to writingHandle
[unzipTask setStandardOutput: writingHandle];
// Unzip - run task
[unzipTask launch];
[unzipTask waitUntilExit];
// Read Image Data and remove File
NSData *thumbnailData = [NSData dataWithContentsOfFile: tmpPath];
[[NSFileManager defaultManager] removeFileAtPath: tmpPath handler:nil];
if ( thumbnailData == nil || [thumbnailData length] == 0 ) {
// Nothing Found. Don't care.
[pool release];
return noErr;
}
// That is the Size our image should have - create a dictionary too
CGSize size = CGSizeMake(256, 256);
NSDictionary *properties = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:size.width],kQLPreviewPropertyWidthKey,
[NSNumber numberWithInt:size.height],kQLPreviewPropertyHeightKey,
nil];
// Get CGContext for Thumbnail
CGContextRef CGContext = QLThumbnailRequestCreateContext(thumbnail, size, TRUE, (CFDictionaryRef)properties);
if(CGContext) {
NSGraphicsContext* context = [NSGraphicsContext graphicsContextWithGraphicsPort:(void *)CGContext flipped:size.width > size.height];
if(context) {
//These two lines of code are just good safe programming…
[NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext:context];
NSBitmapImageRep *thumbnailBitmap = [NSBitmapImageRep imageRepWithData:thumbnailData];
[thumbnailBitmap draw];
//This line sets the context back to what it was when we're done
[NSGraphicsContext restoreGraphicsState];
}
// When we are done with our drawing code QLThumbnailRequestFlushContext() is called to flush the context
QLThumbnailRequestFlushContext(thumbnail, CGContext);
// Release the CGContext
CFRelease(CGContext);
}
[pool release];
return noErr;
}
Info.plist
You will have to modify your info.plist file too - when you open it up it has a lot of fields pre-set. Most of them are self-explaning (or will not have to be changed) but I had to add the following structure (copy paste should do - copy the text, go into the plist editor and just paste.):
您还必须修改info.plist文件 - 当您打开它时,它预先设置了很多字段。他们中的大多数是自我解释(或不必更改)但我必须添加以下结构(复制粘贴应该 - 复制文本,进入plist编辑器,然后粘贴。):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>com.pkware.zip-archive</string>
</array>
<key>UTTypeDescription</key>
<string>i-net Crystal-Clear Report File</string>
<key>UTTypeIconName</key>
<string>generic</string>
<key>UTTypeIdentifier</key>
<string>com.company.product</string>
<key>UTTypeReferenceURL</key>
<string>http://your-url.com</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>$fileEXT$</string>
</array>
</dict>
</dict>
</array>
</plist>
This will register your filetype $fileExt$ and tell the system that your filetype is a zipy format type. A nice refference, that I used here is the QuickLook IPA Plugin from googlecode
这将注册您的文件类型$ fileExt $并告诉系统您的文件类型是压缩格式类型。我在这里使用的一个很好的参考是来自googlecode的QuickLook IPA插件
#3
2
In Windows, what you need is to implement an Icon Handler. I did this many moons ago and it is not difficult as long as you know the basics of COM.
在Windows中,您需要实现一个图标处理程序。我之前做了很多这个月,只要你了解COM的基础知识就不难了。
See: http://msdn.microsoft.com/en-us/library/bb776857(VS.85).aspx
#5
0
This is up to the operating system as far as I know, it will be based on the file extension.
据我所知,这取决于操作系统,它将基于文件扩展名。
#7
0
Executables have the icon inside the file (potentially multiple) as a "resource".
可执行文件将文件内的图标(可能是多个)作为“资源”。
Data files pick up an icon based on file association.
数据文件根据文件关联选择一个图标。
If you want a custom icon per file that is much harder. you either need too fool the OS into thinking it is an executable and embed the icon as a resource in the file, or deep link into the OS to override the default icon selection routine.
如果你想要每个文件的自定义图标更难。你要么太傻了,操作系统认为它是一个可执行文件,并将图标作为资源嵌入文件,或深入链接到操作系统以覆盖默认的图标选择例程。
#8
0
I think, "custom own" icon can have only PE files in windows. Every other icons for file extensions are stored in windows registry.
我认为,“自定义”图标在Windows中只能包含PE文件。文件扩展名的每个其他图标都存储在Windows注册表中。
For specification of PE file, you can look at An In-Depth Look into the Win32 Portable Executable File Format and Peering Inside the PE: A Tour of the Win32 Portable Executable File Format.
对于PE文件的规范,您可以深入了解Win32可移植可执行文件格式和PE内部对等:Win32可移植可执行文件格式之旅。
How it works in other OS, I don't know :/.
如何在其他操作系统中工作,我不知道:/。
#9
0
I don't know about Linux, but for Windows you can start here: http://msdn.microsoft.com/en-us/library/bb774614.aspx
我不知道Linux,但对于Windows,你可以从这里开始:http://msdn.microsoft.com/en-us/library/bb774614.aspx
Edit: I think this interface is for the thumbnails shown in thumbnail view, not icons. Sorry for wasting your time.
编辑:我认为此界面用于缩略图视图中显示的缩略图,而不是图标。抱歉浪费你的时间。
#1
8
Windows
What you need is an Icon Handler, also known as a Thumbnail Handler. Here is an example written as an active x control.
你需要的是一个Icon Handler,也称为Thumbnail Handler。这是一个写为活动x控件的示例。
Another resource is to look up Property Handlers, which should also point to you to the latest and greatest way of having dynamic meta data handled correctly in windows.
另一个资源是查找属性处理程序,它还应该指向您在Windows中正确处理动态元数据的最新和最好的方法。
These are dynamic solutions - they aren't needed if you just want an icon associated with all your files - they are only used when you want windows explorer to display an icon based on what's in the file, not just the extension, and when the file changes the icon is updated to reflect the changes. It doesn't have to be an image of the file itself, either, the thumbnail handler can generate any image based on the file contents.
这些是动态解决方案 - 如果您只想要一个与所有文件相关联的图标,则不需要它们 - 只有当您希望Windows资源管理器根据文件中的内容(而不仅仅是扩展名)显示图标时才使用它们。文件更改图标已更新以反映更改。它不必是文件本身的图像,缩略图处理程序也可以根据文件内容生成任何图像。
The property handler updates other metadata, such as song or video length, so you can use all the metadata Windows Explorer supports.
属性处理程序更新其他元数据,例如歌曲或视频长度,因此您可以使用Windows资源管理器支持的所有元数据。
Regarding MAC support, this page says, "The Mac and Windows operating systems have different methods of enabling this type of thumbnail, and in the case of the Mac OS, this support has been inconsistent from version to version so it hasn't been pursued [for Adobe InDesign]."
关于MAC支持,这个页面说,“Mac和Windows操作系统有不同的方法来启用这种类型的缩略图,而在Mac OS的情况下,这种支持在版本之间是不一致的,所以它没有被追求[适用于Adobe InDesign]。“
OS X
Icons for Mac OSX are determined by the Launch Services Database. However, it refers to a static icon file for all files handled by a registered application (it's not based on extension - each file has meta data attached that determines the application to which it belongs, although extensions give hints when the meta data doesn't exist, such as getting the file from a different OS or file system)
Mac OSX的图标由启动服务数据库确定。但是,它指的是由注册应用程序处理的所有文件的静态图标文件(它不是基于扩展名 - 每个文件都附加了元数据,用于确定它所属的应用程序,尽管扩展在元数据不提供时提供提示存在,例如从不同的OS或文件系统获取文件)
It appears that the dynamic icon functionality in OSX is provided by Finder, but searches aren't bringing up any easy pointers in this direction. Since Finder keeps changing over time, I can see why this target is hard to hit...
OSX中的动态图标功能似乎是由Finder提供的,但搜索并没有在这个方向上提出任何简单的指针。由于Finder不断变化,我可以看出为什么这个目标很难被击中...
Gnome
For Gnome you use a thumbnailer. (thanks Dorward)
对于Gnome,你使用缩略图。 (感谢Dorward)
This is an extraordinarily simple program you write, which has 3 command line arguments:
这是一个非常简单的程序,它有3个命令行参数:
- input file name, the file you are describing with the thumbnail (or URI if you accept those instead)
- output file name, where you need to write the PNG
- size, a number, in pixels, that describes the maximum square image size you should produce (128 --> 128x128 or smaller)
输入文件名,用缩略图描述的文件(如果接受,则为URI)
输出文件名,您需要在其中编写PNG
size,一个数字,以像素为单位,描述您应该生成的最大方形图像大小(128 - > 128x128或更小)
I wish all systems were this simple. On the other hand this doesn't support animation and a few other features that are provided by more difficult to implement plugins on other systems.
我希望所有系统都这么简单。另一方面,这不支持动画和其他系统上更难实现的插件提供的一些其他功能。
KDE
I'm a bit uncertain, but there are a few pointers that should get you started. First is that Konqueror is the file manager and displays the icons - it supports dynamic icons for some inbuilt types, but I don't know if these are hardcoded, or plugins you can write. Check out the Embedded Components Tutorial for a starting point.
我有点不确定,但有一些指针应该让你开始。首先是Konqueror是文件管理器并显示图标 - 它支持一些内置类型的动态图标,但我不知道这些是硬编码还是可以编写的插件。查看嵌入式组件教程了解起点。
There's a new (ish?) feature (or planned feature...) called Plasma which has a great deal to do with icons and icon functionality. Check out this announcment and this initial implementation.
有一个名为Plasma的新(ish?)功能(或计划功能......),它与图标和图标功能有很大关系。看看这个公告和这个初步实现。
You may need to dig into the source of Konqueror and check out how they did this for text files and others already implemented.
您可能需要深入了解Konqueror的来源,并查看他们如何为文本文件和其他已实现的文件执行此操作。
-Adam
#2
4
Mac OSX since version 10.5 …
… has two approaches:
......有两种方法:
-
Your document is in the standard OSX bundle format and has a static image This can be done by creating a subfolder QuickLook and placing the Thumbnail/Preview.png/tiff/jpg inside.
您的文档采用标准OSX包格式并具有静态图像这可以通过创建子文件夹QuickLook并将Thumbnail / Preview.png / tiff / jpg放在其中来完成。
-
Everything else needs a QuickLook generator plugin which can be stored in either /Library/QuickLook ~/Library/QuickLook or inside the YourApp.app/Contents/Library/QuickLook Folders.
其他所有东西都需要一个QuickLook生成器插件,可以存储在/ Library / QuickLook~ / Library / QuickLook或YourApp.app/Contents/Library/QuickLook文件夹中。
This generator is being used to create Thumbnails and QuickLook previews on the fly. XCode offers a template for this. The template generates the needed ANSI C files which have to be implemented. If you want to write Object-C code you have to rename the GenerateThumbnailForURL.c and GeneratePreviewForURL.c to GenerateThumbnailForURL.m and GeneratePreviewForURL.m (and read the Apple Devel Docs carefully ;) )
此生成器用于动态创建缩略图和QuickLook预览。 XCode为此提供了一个模板。该模板生成必须实现的所需ANSI C文件。如果要编写Object-C代码,则必须将GenerateThumbnailForURL.c和GeneratePreviewForURL.c重命名为GenerateThumbnailForURL.m和GeneratePreviewForURL.m(并仔细阅读Apple Devel Docs;))
Simple zip container based demo:
You will have to add the Cocoa.framework and Foundation.framework to your project In your GenerateThumbnailForURL.c (this is partly out of my head - so no guarantee that it works out of the box ;) ):
你必须将Cocoa.framework和Foundation.framework添加到你的项目中你的GenerateThumbnailForURL.c(这部分不在我的脑海里 - 所以不能保证它开箱即用;)):
#include <Cocoa/Cocoa.h>
#include <Foundation/Foundation.h>
OSStatus GenerateThumbnailForURL(void *thisInterface, QLThumbnailRequestRef thumbnail, CFURLRef url, CFStringRef contentTypeUTI, CFDictionaryRef options, CGSize maxSize)
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
/* unzip the thumbnail and put it into an NSData object */
// Create temporary path and writing handle for extraction
NSString *tmpPath = [NSTemporaryDirectory() stringByAppendingFormat: [NSString stringWithFormat: @"%.0f.%@" , [NSDate timeIntervalSinceReferenceDate] * 1000.0, @"png"]];
[[NSFileManager defaultManager] createFileAtPath: tmpPath contents: [NSData alloc] attributes:nil];
NSFileHandle *writingHandle = [NSFileHandle fileHandleForWritingAtPath: tmpPath];
// Use task to unzip - create command: /usr/bin/unzip -p <pathToFile> <fileToExtract>
NSTask *unzipTask = [[NSTask alloc] init];
[unzipTask setLaunchPath: @"/usr/bin/unzip"];
// -p -> output to StandardOut, added File to extract, nil to terminate Array
[unzipTask setArguments: [NSArray arrayWithObjects: @"-p", [(NSURL *) url path], @"Thumbnails/thumbnail.png", nil]];
// redirect standardOut to writingHandle
[unzipTask setStandardOutput: writingHandle];
// Unzip - run task
[unzipTask launch];
[unzipTask waitUntilExit];
// Read Image Data and remove File
NSData *thumbnailData = [NSData dataWithContentsOfFile: tmpPath];
[[NSFileManager defaultManager] removeFileAtPath: tmpPath handler:nil];
if ( thumbnailData == nil || [thumbnailData length] == 0 ) {
// Nothing Found. Don't care.
[pool release];
return noErr;
}
// That is the Size our image should have - create a dictionary too
CGSize size = CGSizeMake(256, 256);
NSDictionary *properties = [NSDictionary dictionaryWithObjectsAndKeys:
[NSNumber numberWithInt:size.width],kQLPreviewPropertyWidthKey,
[NSNumber numberWithInt:size.height],kQLPreviewPropertyHeightKey,
nil];
// Get CGContext for Thumbnail
CGContextRef CGContext = QLThumbnailRequestCreateContext(thumbnail, size, TRUE, (CFDictionaryRef)properties);
if(CGContext) {
NSGraphicsContext* context = [NSGraphicsContext graphicsContextWithGraphicsPort:(void *)CGContext flipped:size.width > size.height];
if(context) {
//These two lines of code are just good safe programming…
[NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext:context];
NSBitmapImageRep *thumbnailBitmap = [NSBitmapImageRep imageRepWithData:thumbnailData];
[thumbnailBitmap draw];
//This line sets the context back to what it was when we're done
[NSGraphicsContext restoreGraphicsState];
}
// When we are done with our drawing code QLThumbnailRequestFlushContext() is called to flush the context
QLThumbnailRequestFlushContext(thumbnail, CGContext);
// Release the CGContext
CFRelease(CGContext);
}
[pool release];
return noErr;
}
Info.plist
You will have to modify your info.plist file too - when you open it up it has a lot of fields pre-set. Most of them are self-explaning (or will not have to be changed) but I had to add the following structure (copy paste should do - copy the text, go into the plist editor and just paste.):
您还必须修改info.plist文件 - 当您打开它时,它预先设置了很多字段。他们中的大多数是自我解释(或不必更改)但我必须添加以下结构(复制粘贴应该 - 复制文本,进入plist编辑器,然后粘贴。):
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<array>
<dict>
<key>UTTypeConformsTo</key>
<array>
<string>com.pkware.zip-archive</string>
</array>
<key>UTTypeDescription</key>
<string>i-net Crystal-Clear Report File</string>
<key>UTTypeIconName</key>
<string>generic</string>
<key>UTTypeIdentifier</key>
<string>com.company.product</string>
<key>UTTypeReferenceURL</key>
<string>http://your-url.com</string>
<key>UTTypeTagSpecification</key>
<dict>
<key>public.filename-extension</key>
<array>
<string>$fileEXT$</string>
</array>
</dict>
</dict>
</array>
</plist>
This will register your filetype $fileExt$ and tell the system that your filetype is a zipy format type. A nice refference, that I used here is the QuickLook IPA Plugin from googlecode
这将注册您的文件类型$ fileExt $并告诉系统您的文件类型是压缩格式类型。我在这里使用的一个很好的参考是来自googlecode的QuickLook IPA插件
#3
2
In Windows, what you need is to implement an Icon Handler. I did this many moons ago and it is not difficult as long as you know the basics of COM.
在Windows中,您需要实现一个图标处理程序。我之前做了很多这个月,只要你了解COM的基础知识就不难了。
See: http://msdn.microsoft.com/en-us/library/bb776857(VS.85).aspx
#4
#5
0
This is up to the operating system as far as I know, it will be based on the file extension.
据我所知,这取决于操作系统,它将基于文件扩展名。
#6
#7
0
Executables have the icon inside the file (potentially multiple) as a "resource".
可执行文件将文件内的图标(可能是多个)作为“资源”。
Data files pick up an icon based on file association.
数据文件根据文件关联选择一个图标。
If you want a custom icon per file that is much harder. you either need too fool the OS into thinking it is an executable and embed the icon as a resource in the file, or deep link into the OS to override the default icon selection routine.
如果你想要每个文件的自定义图标更难。你要么太傻了,操作系统认为它是一个可执行文件,并将图标作为资源嵌入文件,或深入链接到操作系统以覆盖默认的图标选择例程。
#8
0
I think, "custom own" icon can have only PE files in windows. Every other icons for file extensions are stored in windows registry.
我认为,“自定义”图标在Windows中只能包含PE文件。文件扩展名的每个其他图标都存储在Windows注册表中。
For specification of PE file, you can look at An In-Depth Look into the Win32 Portable Executable File Format and Peering Inside the PE: A Tour of the Win32 Portable Executable File Format.
对于PE文件的规范,您可以深入了解Win32可移植可执行文件格式和PE内部对等:Win32可移植可执行文件格式之旅。
How it works in other OS, I don't know :/.
如何在其他操作系统中工作,我不知道:/。
#9
0
I don't know about Linux, but for Windows you can start here: http://msdn.microsoft.com/en-us/library/bb774614.aspx
我不知道Linux,但对于Windows,你可以从这里开始:http://msdn.microsoft.com/en-us/library/bb774614.aspx
Edit: I think this interface is for the thumbnails shown in thumbnail view, not icons. Sorry for wasting your time.
编辑:我认为此界面用于缩略图视图中显示的缩略图,而不是图标。抱歉浪费你的时间。