Script 14: Zip in Studio for WinRT XAML

image

Zip

ComponentOne Zip™ for WinRT XAML provides a complete implementation of the Zip compression standard. Improve the performance of your Windows Store apps by compressing the data sent over the wire and securing it with data encryption. The C1Zip library is the only complete, cross-platform Zip implementation.

  • Compress Files and Folders

Compressed files take up less storage space and can be transferred over the web more quickly than uncompressed files. Store resources as compressed files, download them efficiently, and then decompress them on the client side. You can also combine several files into a single compressed folder, making it easier to share a group of files. Compress and expand folders while preserving folder structure.

  • Get and Set File Information

Easily obtain zip file information including a detailed list of the zip file's contents. You can also control file information by adding and retrieving comments and control path information for individual entries in the zip file, and getting and setting the global zip file comment. Access files within a zip archive by index or file name with ease using the C1ZipFile and C1ZipEntry classes.

  • Data Encryption

C1Zip supports data encryption, so you can create secure archives that require a password to unzip. With C1Zip you can also decompress archives that are encrypted so long as you have the original password used when the zip was created.

  • Perfect for XML Data

XML is one of the most common formats used by web applications. XML data typically compresses to about 10% of the original size.

  • Cross-platform Compatibility

The C1Zip library is available for every .NET platform including Windows Forms, ASP.NET, WPF, Silverlight, Windows Phone, and WinRT. Re-use much of the same code and support in more than one platform. The Microsoft ZipArchive and Compression classes are only available in .NET 4.5 on Windows 8.

Here is some sample code to get you started with Zip

Open a Zip File from Users Machine

You can allow the user to select and open a Zip file from their documents library using the FileOpenPicker class. Use the following code to open a file with C1Zip. This sample also assumes you have a C1FlexGrid control on your page named “flex” to display the results.

To set up your project, complete the following steps:

  1. In Visual Studio, select File | New | Project.

  2. In the New Project dialog box, expand a language in the left pane, under the language select Windows Metro style, and in the templates list select Blank App (XAML). Enter a Name for your project and click OK to create your project.

  3. Open MainPage.xaml if it isn't already open, place the cursor between the and tags, and click once.

4. Navigate to the Toolbox and double-click the Button icon to add the Button to MainPage.xaml. Modify properties to look as follows: