home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 1
MediaPortal 1 Plugins
Popular Plugins
SubCentral
SubtitleDownloader
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="seco" data-source="post: 878345" data-attributes="member: 54595"><p><span style="font-family: 'trebuchet ms'">Thanks for you suggestion and help, I will include this in the next version. </span></p><p> </p><p><span style="font-family: 'trebuchet ms'">However I think ExtractOptions.ExtractFullPath should not be there since I believe it would extract files to ...OurTempPath/PathInArchive/foo.file instead of ...OurTempPath/foo.file. In the first case Directory.GetFiles(OurTempPath) would not return a</span><span style="font-family: 'trebuchet ms'">nything?</span></p><p> </p><p><span style="font-family: 'trebuchet ms'">EDIT: My tests confirm what I said above, </span><span style="font-family: 'trebuchet ms'">ExtractOptions.ExtractFullPath cannot be used. After leaving it out and creating directory manually, everything should work fine.</span></p><p> </p><p>[CODE] </p><p>public static List<FileInfo> ExtractFilesFromZipOrRarFile(string archiveFile)</p><p> {</p><p> string tempDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());</p><p> Directory.CreateDirectory(tempDirectory);</p><p> </p><p> var archive = ArchiveFactory.Open(archiveFile);</p><p> </p><p> foreach (var entry in archive.Entries)</p><p> {</p><p> if (!entry.IsDirectory)</p><p> entry.WriteToDirectory(tempDirectory);</p><p> }</p><p> </p><p> return Directory.GetFiles(tempDirectory).Select(fileName => new FileInfo(fileName)).ToList();</p><p> }</p><p>[/CODE]</p></blockquote><p></p>
[QUOTE="seco, post: 878345, member: 54595"] [FONT=trebuchet ms]Thanks for you suggestion and help, I will include this in the next version. [/FONT] [FONT=trebuchet ms]However I think ExtractOptions.ExtractFullPath should not be there since I believe it would extract files to ...OurTempPath/PathInArchive/foo.file instead of ...OurTempPath/foo.file. In the first case Directory.GetFiles(OurTempPath) would not return a[/FONT][FONT=trebuchet ms]nything?[/FONT] [FONT=trebuchet ms]EDIT: My tests confirm what I said above, [/FONT][FONT=trebuchet ms]ExtractOptions.ExtractFullPath cannot be used. After leaving it out and creating directory manually, everything should work fine.[/FONT] [CODE] public static List<FileInfo> ExtractFilesFromZipOrRarFile(string archiveFile) { string tempDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName()); Directory.CreateDirectory(tempDirectory); var archive = ArchiveFactory.Open(archiveFile); foreach (var entry in archive.Entries) { if (!entry.IsDirectory) entry.WriteToDirectory(tempDirectory); } return Directory.GetFiles(tempDirectory).Select(fileName => new FileInfo(fileName)).ToList(); } [/CODE] [FONT=trebuchet ms][/FONT] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 1
MediaPortal 1 Plugins
Popular Plugins
SubCentral
SubtitleDownloader
Contact us
RSS
Top
Bottom