I am trying to use a dictionary with the [ZLIB .NET](http://www.componentace.com/zlib_.NET.htm) library but the `ZStream` member `inflateSetDictionary` always returns `Z_STREAM_ERROR`. I have tracked this down to a sub call to `Inflate.inflateSetDictionary` which tests if (`z.istate.mode == DICT0`)

Does anyone know how to use dictionaries with this library or know of any good examples. A simplified version of my code is shown below...

```
public class Form1 : System.Windows.Forms.Form
{
    static private string sDictionary = "VALUE1,VALUE2,VALUE3";

    class GZOutputStream : ZOutputStream
    {
        public GZOutputStream(Stream in_Renamed)
            : base(in_Renamed)
        {

            byte[] dictionary = System.Text.ASCIIEncoding.ASCII.GetBytes(sDictionary);
            z.inflateSetDictionary(dictionary, dictionary.Length);
        }

        public GZOutputStream(Stream in_Renamed, int level)
            : base(in_Renamed, level)
        {

            byte[] dictionary = System.Text.ASCIIEncoding.ASCII.GetBytes(sDictionary);
            z.deflateSetDictionary(dictionary, dictionary.Length);
        }
    }

    class GZInputStream : ZInputStream
    {
        public GZInputStream(Stream in_Renamed)
            : base(in_Renamed)
        {

            byte[] dictionary = System.Text.ASCIIEncoding.ASCII.GetBytes(sDictionary);
            z.inflateSetDictionary(dictionary, dictionary.Length);
        }

        public GZInputStream(Stream in_Renamed, int level)
            : base(in_Renamed, level)
        {

            byte[] dictionary = System.Text.ASCIIEncoding.ASCII.GetBytes(sDictionary);
            z.deflateSetDictionary(dictionary, dictionary.Length);
        }
    }

    public static void CopyStream(System.IO.Stream input, System.IO.Stream output)
    {
        byte[] buffer = new byte[2000];
        int len;
        while ((len = input.Read(buffer, 0, 2000)) > 0)
        {
            output.Write(buffer, 0, len);
        }
        output.Flush();
    }

    private void compressFile(string inFile, string outFile)
    {
        FileStream outFileStream = new System.IO.FileStream(outFile, System.IO.FileMode.Create);
        GZOutputStream outZStream = new GZOutputStream(outFileStream, 1); // zlibConst.Z_DEFAULT_COMPRESSION);
        System.IO.FileStream inFileStream = new System.IO.FileStream(inFile, System.IO.FileMode.Open);          
        try
        {
            CopyStream(inFileStream, outZStream);
        }
        finally
        {
            outZStream.Close();
            outFileStream.Close();
            inFileStream.Close();
        }
    }

    private void decompressFile(string inFile, string outFile)
    {
        FileStream outFileStream = new FileStream(outFile, FileMode.Create);
        GZOutputStream outZStream = new GZOutputStream(outFileStream);
        FileStream inFileStream = new FileStream(inFile, FileMode.Open);            
        try
        {
            CopyStream(inFileStream, outZStream);
        }
        finally
        {
            outZStream.Close();
            outFileStream.Close();
            inFileStream.Close();
        }
    }

}

```