コード例 #1
0
        //This is a window encoder for the VCDIFF format
        //if you are not including a checksum simply pass 0 to checksum
        //it will be ignored
        public WindowEncoder(long dictionarySize, uint checksum, ChecksumFormat checksumFormat, bool interleaved)
        {
            this.Checksum       = checksum;
            this.ChecksumFormat = checksumFormat;
            this.IsInterleaved  = interleaved;
            this.dictionarySize = dictionarySize;

            // The encoder currently doesn't support encoding with a custom table
            // will be added in later since it will be easy as decoding is already implemented
            maxMode         = AddressCache.DefaultLast;
            table           = CodeTable.DefaultTable;
            addrCache       = new AddressCache();
            targetLength    = 0;
            lastOpcodeIndex = -1;
            instrMap        = InstructionMap.Instance;

            //Separate buffers for each type if not interleaved
            if (!interleaved)
            {
                instructionAndSizes = new MemoryStream();
                dataForAddAndRun    = new MemoryStream();
                addressForCopy      = new MemoryStream();
            }
            else
            {
                instructionAndSizes = dataForAddAndRun = addressForCopy = new MemoryStream();
            }
        }