Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions libraries/radziplibrary/features/compress-stream.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ You can create a compressed stream by initializing a new instance of the __Compr

#### __[C#] Example 1: Write to compressed stream__

{{region radziplibrary-compress-stream_0}}
{{region cs-radziplibrary-compress-stream_0}}

using (CompressedStream compressedStream = new CompressedStream(outputStream, StreamOperationMode.Write, new DeflateSettings()))
{
// write to compressed stream
Expand All @@ -71,9 +72,9 @@ You can create a compressed stream by initializing a new instance of the __Compr

#### __[VB.NET] Example 1: Write to compressed stream__

{{region radziplibrary-compress-stream_0}}
{{region vb-radziplibrary-compress-stream_0}}
Using compressedStream As New CompressedStream(outputStream, StreamOperationMode.Write, New DeflateSettings())
' write to compressed stream
' write to compressed stream
End Using
{{endregion}}

Expand All @@ -84,7 +85,8 @@ If you want to compress a specific stream (*inputStream*), you need to copy it t

#### __[C#] Example 2: Write stream to compressed stream__

{{region radziplibrary-compress-stream_1}}
{{region cs-radziplibrary-compress-stream_1}}

using (CompressedStream compressedStream = new CompressedStream(outputStream, StreamOperationMode.Write, new DeflateSettings()))
{
inputStream.CopyTo(compressedStream);
Expand All @@ -96,10 +98,10 @@ If you want to compress a specific stream (*inputStream*), you need to copy it t

#### __[VB.NET] Example 2: Write stream to compressed stream__

{{region radziplibrary-compress-stream_1}}
{{region vb-radziplibrary-compress-stream_1}}
Using compressedStream As New CompressedStream(outputStream, StreamOperationMode.Write, New DeflateSettings())
inputStream.CopyTo(compressedStream)
compressedStream.Flush()
inputStream.CopyTo(compressedStream)
compressedStream.Flush()
End Using
{{endregion}}

Expand All @@ -112,7 +114,8 @@ Decompressing a stream is just as simple as compressing it. All you need to do i

#### __[C#] Example 3: Decompressed stream__

{{region radziplibrary-compress-stream_2}}
{{region cs-radziplibrary-compress-stream_2}}

using (CompressedStream compressedStream = new CompressedStream(inputStream, StreamOperationMode.Read, new DeflateSettings()))
{
compressedStream.CopyTo(outputStream);
Expand All @@ -123,9 +126,9 @@ Decompressing a stream is just as simple as compressing it. All you need to do i

#### __[VB.NET] Example 3: Decompressed stream__

{{region radziplibrary-compress-stream_2}}
{{region vb-radziplibrary-compress-stream_2}}
Using compressedStream As New CompressedStream(inputStream, StreamOperationMode.Read, New DeflateSettings())
compressedStream.CopyTo(outputStream)
compressedStream.CopyTo(outputStream)
End Using
{{endregion}}

Expand All @@ -148,7 +151,7 @@ CompressedStream derives from the Stream class and therefore it supports all its
* __Length__: The uncompressed size of the stream.


# See Also
## See Also

* [Protect ZipArchive]({%slug radziplibrary-protect-ziparchive%})
* [Compression Settings]({%slug radziplibrary-compression-settings%})
16 changes: 9 additions & 7 deletions libraries/radziplibrary/features/compression-settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ __Example 1__ demonstrates how to create DeflateSettings.

#### __[C#] Example 1: Create DeflateSettings__

{{region radziplibrary-compression-settings_0}}
{{region cs-radziplibrary-compression-settings_0}}

DeflateSettings compressionSettings = new DeflateSettings();
compressionSettings.CompressionLevel = CompressionLevel.Best;
compressionSettings.HeaderType = CompressedStreamHeader.ZLib;
Expand All @@ -47,7 +48,7 @@ __Example 1__ demonstrates how to create DeflateSettings.

#### __[VB.NET] Example 1: Create DeflateSettings__

{{region radziplibrary-compression-settings_0}}
{{region vb-radziplibrary-compression-settings_0}}
Dim compressionSettings As New DeflateSettings()
compressionSettings.CompressionLevel = CompressionLevel.Best
compressionSettings.HeaderType = CompressedStreamHeader.ZLib
Expand Down Expand Up @@ -85,7 +86,8 @@ The configurable parameters of the __LzmaSettings__ class are as follows:

#### __[C#] Example 2: Create LzmaSettings__

{{region radziplibrary-compression-settings_1}}
{{region cs-radziplibrary-compression-settings_1}}

LzmaSettings compressionSettings = new LzmaSettings();
compressionSettings.DictionarySize = 23;
compressionSettings.FastBytes = 32;
Expand All @@ -99,7 +101,7 @@ The configurable parameters of the __LzmaSettings__ class are as follows:

#### __[VB.NET] Example 2: Create LzmaSettings__

{{region radziplibrary-compression-settings_1}}
{{region vb-radziplibrary-compression-settings_1}}
Dim compressionSettings As New LzmaSettings()
compressionSettings.DictionarySize = 23
compressionSettings.FastBytes = 32
Expand All @@ -118,19 +120,19 @@ Store settings are used to just store the data using no compression.

#### __[C#] Example 3: Create StoreSettings__

{{region radziplibrary-compression-settings_2}}
{{region cs-radziplibrary-compression-settings_2}}
StoreSettings compressionSettings = new StoreSettings();
{{endregion}}



#### __[VB.NET] Example 3: Create StoreSettings__

{{region radziplibrary-compression-settings_2}}
{{region vb-radziplibrary-compression-settings_2}}
Dim compressionSettings As New StoreSettings()
{{endregion}}


# See Also
## See Also

* [Compressing a Stream]({%slug radziplibrary-compress-stream%})
50 changes: 25 additions & 25 deletions libraries/radziplibrary/features/protect-ziparchive.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ __DefaultEncryptionSettings__ has a __Password__ property of type string, which

#### __[C#] Example 1: Create a password-protected ZIP archive__

{{region radziplibrary-protect-ziparchive_0}}
{{region cs-radziplibrary-protect-ziparchive_0}}

using (Stream stream = File.Open("test.zip", FileMode.Create))
{
DefaultEncryptionSettings encryptionSettings = new DefaultEncryptionSettings();
Expand All @@ -44,7 +45,7 @@ __DefaultEncryptionSettings__ has a __Password__ property of type string, which
{
StreamWriter writer = new StreamWriter(entry.Open());
writer.WriteLine("Hello world!");
writer.Flush();
writer.Flush();
}
}
}
Expand All @@ -54,17 +55,17 @@ __DefaultEncryptionSettings__ has a __Password__ property of type string, which

#### __[VB.NET] Example 1: Create a password-protected ZIP archive__

{{region radziplibrary-protect-ziparchive_0}}
{{region vb-radziplibrary-protect-ziparchive_0}}
Using stream As Stream = File.Open("test.zip", FileMode.Create)
Dim encryptionSettings As New DefaultEncryptionSettings()
encryptionSettings.Password = "password"
Using archive As New ZipArchive(stream, ZipArchiveMode.Create, False, Nothing, Nothing, encryptionSettings)
Using entry As ZipArchiveEntry = archive.CreateEntry("text.txt")
Dim writer As New StreamWriter(entry.Open())
writer.WriteLine("Hello world!")
writer.Flush()
End Using
End Using
Dim encryptionSettings As New DefaultEncryptionSettings()
encryptionSettings.Password = "password"
Using archive As New ZipArchive(stream, ZipArchiveMode.Create, False, Nothing, Nothing, encryptionSettings)
Using entry As ZipArchiveEntry = archive.CreateEntry("text.txt")
Dim writer As New StreamWriter(entry.Open())
writer.WriteLine("Hello world!")
writer.Flush()
End Using
End Using
End Using
{{endregion}}

Expand All @@ -80,31 +81,30 @@ In order to open a password-protected __ZipArchive__, you need to pass a __Defau

#### __[C#] Example 2: Open and read a password-protected ZIP archive__

{{region radziplibrary-protect-ziparchive_1}}

{{region cs-radziplibrary-protect-ziparchive_1}}
using (Stream stream = File.Open("test.zip", FileMode.Open))
{
DefaultEncryptionSettings encryptionSettings = new DefaultEncryptionSettings();
encryptionSettings.Password = "password";
using (ZipArchive archive = new ZipArchive(stream, ZipArchiveMode.Read, false, null, null, encryptionSettings))
{
// Display the list of the files in the selected zip file using the ZipArchive.Entries property.
{
// Display the list of the files in the selected zip file using the ZipArchive.Entries property.
}
}
}
{{endregion}}



#### __[VB.NET] Example 2: Open and read a password-protected ZIP archive__

{{region radziplibrary-protect-ziparchive_1}}

{{region vb-radziplibrary-protect-ziparchive_1}}
Using stream As Stream = File.Open("test.zip", FileMode.Open)
Dim encryptionSettings As New DefaultEncryptionSettings()
encryptionSettings.Password = "password"
Using archive As New ZipArchive(stream, ZipArchiveMode.Read, False, Nothing, Nothing, encryptionSettings)
' Display the list of the files in the selected zip file using the ZipArchive.Entries property.
End Using
Dim encryptionSettings As New DefaultEncryptionSettings()
encryptionSettings.Password = "password"
Using archive As New ZipArchive(stream, ZipArchiveMode.Read, False, Nothing, Nothing, encryptionSettings)
' Display the list of the files in the selected zip file using the ZipArchive.Entries property.
End Using
End Using
{{endregion}}

Expand All @@ -113,7 +113,7 @@ In order to open a password-protected __ZipArchive__, you need to pass a __Defau
>tipYou must always dispose of the ZIP archive object when all operations that use it are competed. Telerik Support recommends that you declare and instantiate the ZIP archive object in a using statement. If it is not possible for some reason, then do not forget to call the __Dispose()__ method when you complete all operations.


# See Also
## See Also

* [Getting Started]({%slug radziplibrary-gettingstarted%})
* [Update ZipArchive]({%slug radziplibrary-update-ziparchive%})
65 changes: 34 additions & 31 deletions libraries/radziplibrary/features/update-ziparchive.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,25 +23,26 @@ The code snippet from __Example 1__ opens a ZIP archive in update mode using __Z

#### __[C#] Example 1: Open for update__

{{region radziplibrary-update-ziparchive_0}}
using (Stream stream = File.Open("test.zip", FileMode.Open))
{
using (ZipArchive archive = new ZipArchive(stream, ZipArchiveMode.Update, false, null))
{
// Display the list of the files in the selected zip file using the ZipArchive.Entries property.
}
}
{{region cs-radziplibrary-update-ziparchive_0}}

using (Stream stream = File.Open("test.zip", FileMode.Open))
{
using (ZipArchive archive = new ZipArchive(stream, ZipArchiveMode.Update, false, null))
{
// Display the list of the files in the selected zip file using the ZipArchive.Entries property.
}
}
{{endregion}}



#### __[VB.NET] Example 1: Open for update__

{{region radziplibrary-update-ziparchive_0}}
{{region vb-radziplibrary-update-ziparchive_0}}
Using stream As Stream = File.Open("test.zip", FileMode.Open)
Using archive As New ZipArchive(stream, ZipArchiveMode.Update, False, Nothing)
' Display the list of the files in the selected zip file using the ZipArchive.Entries property.
End Using
Using archive As New ZipArchive(stream, ZipArchiveMode.Update, False, Nothing)
' Display the list of the files in the selected zip file using the ZipArchive.Entries property.
End Using
End Using
{{endregion}}

Expand All @@ -66,7 +67,8 @@ In order to add a new entry into the ZIP archive, you should perform the followi

#### __[C#] Example 2: Add entry__

{{region radziplibrary-update-ziparchive_1}}
{{region cs-radziplibrary-update-ziparchive_1}}

using (ZipArchiveEntry entry = archive.CreateEntry("text.txt"))
{
StreamWriter writer = new StreamWriter(entry.Open());
Expand All @@ -79,11 +81,11 @@ In order to add a new entry into the ZIP archive, you should perform the followi

#### __[VB.NET] Example 2: Add entry__

{{region radziplibrary-update-ziparchive_1}}
{{region vb-radziplibrary-update-ziparchive_1}}
Using entry As ZipArchiveEntry = archive.CreateEntry("text.txt")
Dim writer As New StreamWriter(entry.Open())
writer.WriteLine("Hello world!")
writer.Flush()
Dim writer As New StreamWriter(entry.Open())
writer.WriteLine("Hello world!")
writer.Flush()
End Using
{{endregion}}

Expand All @@ -99,7 +101,8 @@ __Example 3__ shows how you could obtain an entry and delete it from the ZIP arc

#### __[C#] Example 3: Delete entry__

{{region radziplibrary-update-ziparchive_2}}
{{region cs-radziplibrary-update-ziparchive_2}}

ZipArchiveEntry entry = archive.GetEntry("text.txt");
if (entry != null)
{
Expand All @@ -111,10 +114,10 @@ __Example 3__ shows how you could obtain an entry and delete it from the ZIP arc

#### __[VB.NET] Example 3: Delete entry__

{{region radziplibrary-update-ziparchive_2}}
{{region vb-radziplibrary-update-ziparchive_2}}
Dim entry As ZipArchiveEntry = archive.GetEntry("text.txt")
If entry IsNot Nothing Then
entry.Delete()
entry.Delete()
End If
{{endregion}}

Expand All @@ -138,14 +141,14 @@ In order to update an existing entry in the ZIP archive, you should perform the

#### __[C#] Example 4: Update entry__

{{region radziplibrary-update-ziparchive_3}}
{{region cs-radziplibrary-update-ziparchive_3}}
ZipArchiveEntry entry = archive.GetEntry("text.txt");
if (entry != null)
{
Stream entryStream = entry.Open();
StreamReader reader = new StreamReader(entryStream);
string content = reader.ReadToEnd();

entryStream.Seek(0, SeekOrigin.End);
StreamWriter writer = new StreamWriter(entryStream);
writer.WriteLine("Updated line.");
Expand All @@ -157,22 +160,22 @@ In order to update an existing entry in the ZIP archive, you should perform the

#### __[VB.NET] Example 4: Update entry__

{{region radziplibrary-update-ziparchive_3}}
{{region vb-radziplibrary-update-ziparchive_3}}
Dim entry As ZipArchiveEntry = archive.GetEntry("text.txt")
If entry IsNot Nothing Then
Dim entryStream As Stream = entry.Open()
Dim reader As New StreamReader(entryStream)
Dim content As String = reader.ReadToEnd()
Dim entryStream As Stream = entry.Open()
Dim reader As New StreamReader(entryStream)
Dim content As String = reader.ReadToEnd()

entryStream.Seek(0, SeekOrigin.End)
Dim writer As New StreamWriter(entryStream)
writer.WriteLine("Updated line.")
writer.Flush()
entryStream.Seek(0, SeekOrigin.End)
Dim writer As New StreamWriter(entryStream)
writer.WriteLine("Updated line.")
writer.Flush()
End If
{{endregion}}



# See Also
## See Also

* [Getting Started]({%slug radziplibrary-gettingstarted%})
2 changes: 1 addition & 1 deletion libraries/radziplibrary/features/zip-extensions.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ This class implements the [IPlatformManager](http://docs.telerik.com/devtools/do
* __bool IsEncodingSupported(Encoding encoding)__: Indicates whether specified encoding is supported for this platform. <returns>true if encoding is allowed in the ZIP file.


# See Also
## See Also

* [Compression Settings]({%slug radziplibrary-compression-settings%})
* [Compress Stream]({%slug radziplibrary-compress-stream%})
Expand Down
Loading