Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: VB.NET ZIP
Hello Friends
I am VB.NET Programmer and currently working on a project where i have to copy the rar/zip file from any folder.
While pasting it, it should extract the rar/zip contents automatically.
I am done with my extracting part but
 
Here are some problems i am facing
 
Problem 1 : How should i detect that a rar/zip file is copied by the system ?
 
Problem 2 : How to track the file in which it has to be paste ?
All operation will be done from system context menu.
 
Kindly Help me Thank You
Posted 4-Mar-13 1:47am
Kumar_G123

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

RAR is proprietary; I would not advise to use it, but — please see below, you can always un-RAR.
 

Problem 1:

If you really need to detect the event like that, it may mean that your architecture seriously needs rethinking. If you still think you need go this way, the solution is to use the class System.IO.FileSystemWatcher:
http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx[^].
 
It's use can be problematic though; please see these CodeProject articles:
FileSystemWatcher - Pure Chaos (Part 1 of 2)[^],
FileSystemWatcher - Pure Chaos (Part 2 of 2)[^].
 
I would not advise you to get into it but would rather advise to review the architecture, but decide by yourself; I don't know your goals. (That's why this is a good idea to share them first when asking your questions.)
 
To work with just ZIP, you can use #ziplib:
http://www.icsharpcode.net/opensource/sharpziplib/[^].
 
Another option is using SevenZipSharp, a .NET wrapper of the famous 7-Zip:
http://en.wikipedia.org/wiki/7-Zip[^],
http://sevenzipsharp.codeplex.com/[^].
 
7-zip does support ZIP, RAR and a lot more.
 
Both libraries are open-source.
 

Problem 2:

It does not seem to make sense. Compression is not related to Past. If your code pastes, you don't need to "track" anything, your call can trigger whatever you want. If you want to capture Paste event, you need to understand what are you pasting; again, it has nothing to do with file compression. Perhaps I did not understand this part, but you certainly did not explain it properly.
 
—SA
  Permalink  
v3
Comments
Kumar_G at 7-Mar-13 7:56am
   
I want to know how does the system knows that a rar/zip file has been copied ?
So that i can implement in my context menu
Sergey Alexandrovich Kryukov at 7-Mar-13 12:46pm
   
As I explained, FileSystemWatcher. Is that clear now?
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 555
1 Kornfeld Eliyahu Peter 409
2 Maciej Los 359
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,353
1 DamithSL 4,854
2 Maciej Los 4,466
3 Kornfeld Eliyahu Peter 4,058
4 Sergey Alexandrovich Kryukov 3,897


Advertise | Privacy | Mobile
Web01 | 2.8.141220.1 | Last Updated 4 Mar 2013
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100