开发者

Open archive file content in OpenFileDiaolg C#

开发者 https://www.devze.com 2023-01-01 07:53 出处:网络
I want an Open File Dialog with ****.class*** ,****.jar*** filters. I want that *.jar files will be treated as folders (pressing OK or double-click should display the jar file content [ *.class] ). Th

I want an Open File Dialog with ****.class*** ,****.jar*** filters. I want that *.jar files will be treated as folders (pressing OK or double-click should display the jar file content [ *.class] ). This capability is very similar to the TotalCommander archive plugin that let you browse inside archive files in-place开发者_运维百科 (without the need to extract them, etc...)

Any ideas how it could be done? Can I use something that is already implemented?

Thanks, Guy


To do this with that standard windows explorer and common dialogs you will need to write or find an appropiate Shell namespace extension.

A shell namespace extension is an COM object that allows you to present virtual folders in the explorer shell. So in your case the shell extension will allow the user to navigate the jar file structure as if it where a folder on your machine.

You can write a shell extension with managed code, but at least for versions of the framework prior to 4.0 this was not supported by MS because of potention problems with conflict of loading more than one version of the framework into a process. Now that 4.0 supports side by side loading of framework versions, maybe this is supported.

Here is a link to an article on writting a shell namespace extension
http://msdn.microsoft.com/en-us/magazine/cc188741.aspx

I never tried this, but here is an extension that supports treting 7-zip supported files as a folder. Maybe this will help you at least get started if you need to do this yourself.
http://7zipshell.codeplex.com/


Here's an article that describes the opening of Jars in C#:

http://www.codeproject.com/KB/files/opening_jars_cs.aspx

If you combine that either with Chris answer about writing an extension or you write your own dialog if that's easier, you should be able to do what you want.

0

精彩评论

暂无评论...
验证码 换一张
取 消