Differences between revisions 6 and 7
Revision 6 as of 2015-04-05 02:11:28
Size: 3022
Comment:
Revision 7 as of 2015-04-12 22:59:09
Size: 3014
Comment: Reformatting of paragraphs
Deletions are marked like this. Additions are marked like this.
Line 38: Line 38:
Sometimes you want to be able to store a multitude of character vector representing scripted namespaces, xaml vectors, config files, ini files,
serialized apldata to XML/JSON, etc.
The function `AplToZipFile` is able to save/retrieve a Dyalog namespace containing only characters to a zip file. It is also able
to retrieve only a part of the namespace without !UnZipping the whole file. For examples you could store the configuration and ini files
of your application in a namespace that is written to disk with an extension other than zip (ex. cfg). That way at runtime you can
change the extension to zip, inspect/change the configuration file and change back the extension to cfg. That way the end user
does not have access to the config/ini files and at the same time you can change them easily.
Sometimes you want to be able to store a multitude of character vector representing scripted namespaces, xaml vectors, config files, ini files, serialized apldata to XML/JSON, etc. The function `AplToZipFile` is able to save/retrieve a Dyalog namespace containing only characters to a zip file. It is also able to retrieve only a part of the namespace without !UnZipping the whole file. For examples you could store the configuration and ini files of your application in a namespace that is written to disk with an extension other than zip (ex. cfg). That way at runtime you can change the extension to zip, inspect/change the configuration file and change back the extension to cfg. That way the end user does not have access to the config/ini files and at the same time you can change them easily.
Line 56: Line 50:
1 this is text two  1 this is text two

sfZip

Overview

sfZip is a Dyalog namespace that shows examples on how to use the Syncfusion ZipArchive library. This library can be used to Zip and UnZip text and file(s) on disk.

Installation and deployment

The following assemblies (version 12.2 or newer) are required in the subdirectory /Syncfusion/4.5 of the Dyalog APL version 14 (or newer) directory:

  • Syncfusion.Compression.Base.dll

How to Zip and UnZip text

The functions ZipText and UnZipText are able to compress/decompress unicode character variable of the workspace.

      MyText ← 'This is a test: ⍺⌈⌊_∇∆∘⎕⍎⋄⊢→←*○⍳↓↑~⍴∊∊⍵?'

      MyTextZipped←ZipText MyText

      MyText ≡ UnZipText MyTextZipped
1

How to Zip and UnZip a file on disk

The functions ZipFile and UnZipFile are able to compress/decompress an existing file on disk.

      ZipFile 'D:\MyFile.dyalog'     ⍝ The file D:\MyFile.zip has been created successfully
1

      r ← UnZipFile 'D:\MyFile.zip'  ⍝ The unzip content of D:\MyFile.zip is in the variable 'r'

How to Zip and UnZip a Namespace of Characters

Sometimes you want to be able to store a multitude of character vector representing scripted namespaces, xaml vectors, config files, ini files, serialized apldata to XML/JSON, etc. The function AplToZipFile is able to save/retrieve a Dyalog namespace containing only characters to a zip file. It is also able to retrieve only a part of the namespace without UnZipping the whole file. For examples you could store the configuration and ini files of your application in a namespace that is written to disk with an extension other than zip (ex. cfg). That way at runtime you can change the extension to zip, inspect/change the configuration file and change back the extension to cfg. That way the end user does not have access to the config/ini files and at the same time you can change them easily.

      Config←⎕NS ''

      Config.text1←'this is text one'
      Config.text2←'this is text two'
      Config.text3←'this is text three'

      Config AplToZipFile 'D:\MyConfig.cfg'
1

      'text2' AplToZipFile 'D:\MyConfig.cfg'
1  this is text two

      r ← 2⊃AplToZipFile 'D:\MyConfig.cfg'

      r.text1
this is text one
      r.text2
this is text two
      r.text3
this is text three

How to install sfZip in your workspace

  1. Download sfZip.v1.0.txt

  2. Do a Select all (Ctrl+A) and a copy (Ctrl+C).
  3. In your workspace execute )ed ⍟ sfZip

  4. Paste (Ctrl+V) the text into the Dyalog editor
  5. Press Escape and ')save' your workspace

Version Information

Original author:

Pierre Gilbert

Responsible:

PierreGilbert

Email:

<apgil AT SPAMFREE videotron DOT ca>


CategoryDyalog - CategoryDyalogDotNet - CategorySyncfusionWpfExamples - CategoryDotNet

sfZip (last edited 2015-09-18 15:52:19 by PierreGilbert)