-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #683 from hernanmd/compression_UI_utilities
Compression UI utilities
- Loading branch information
Showing
4 changed files
with
59 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
Extension { #name : 'InflateStream' } | ||
|
||
{ #category : '*NewTools-Compression-Utils' } | ||
InflateStream class >> openWithContents: contentsString label: titleString [ | ||
"Open a text viewer on contentsString and window label titleString" | ||
|
||
SpTextPresenter new | ||
text: contentsString; | ||
open; | ||
withWindowDo: [ : w | | ||
w | ||
title: titleString; | ||
extent: 600 @ 800 ] | ||
] | ||
|
||
{ #category : '*NewTools-Compression-Utils' } | ||
InflateStream class >> viewContents: fullFileName [ | ||
"Open the decompressed contents of fullFileName" | ||
|
||
| file | | ||
(file := fullFileName asFileReference) binaryReadStreamDo: [ :aStream | | ||
self with: aStream do: [ :aGzStream | | ||
self | ||
openWithContents: aGzStream upToEnd | ||
label: 'Decompressed contents of: ' , file basename ] ] | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
Extension { #name : 'ZipArchive' } | ||
|
||
{ #category : '*NewTools-Compression-Utils' } | ||
ZipArchive class >> extractAllIn: aFileReferenceOrFileName [ | ||
"Service method to extract all contents of a zip. | ||
Example: | ||
ZipArchive extractAllIn: 'my_file.zip' | ||
" | ||
| directory | | ||
|
||
directory := (StOpenDirectoryDialog new | ||
currentDirectory: FileSystem workingDirectory; | ||
openModal) ifNil: [ ^ self ]. | ||
|
||
^ self new | ||
readFrom: aFileReferenceOrFileName; | ||
extractAllTo: directory | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Package { #name : 'NewTools-Compression-Utils' } |