Example #1
0
        static void EncodingExample()
        {
            byte[] sourceFile = new byte[] { };
            List<byte> result = new List<byte>();

            using (VCDiffDotNet.LowLevel.Encoder encoder = new VCDiffDotNet.LowLevel.Encoder())
            {
                encoder.InitEncoder(sourceFile, false, false, false, false);

                byte[] partialOutput;
                encoder.StartEncoding(out partialOutput);
                result.AddRange(partialOutput);

                byte[] partOfTargetFile = new byte[] { };
                encoder.EncodeChunk(partOfTargetFile, out partialOutput);
                result.AddRange(partialOutput);

                encoder.FinishEncoding(out partialOutput);
                result.AddRange(partialOutput);
            }

            byte[] patchFile = result.ToArray();
        }
Example #2
0
        static void EncodingExample()
        {
            byte[]      sourceFile = new byte[] { };
            List <byte> result     = new List <byte>();

            using (VCDiffDotNet.LowLevel.Encoder encoder = new VCDiffDotNet.LowLevel.Encoder())
            {
                encoder.InitEncoder(sourceFile, false, false, false, false);

                byte[] partialOutput;
                encoder.StartEncoding(out partialOutput);
                result.AddRange(partialOutput);

                byte[] partOfTargetFile = new byte[] { };
                encoder.EncodeChunk(partOfTargetFile, out partialOutput);
                result.AddRange(partialOutput);

                encoder.FinishEncoding(out partialOutput);
                result.AddRange(partialOutput);
            }

            byte[] patchFile = result.ToArray();
        }
Example #3
0
        static void EncodingExample()
        {
            byte[] sourceFile = File.ReadAllBytes(@"C:\tmp\diff\test.7z");
            List<byte> result = new List<byte>();

            using (VCDiffDotNet.LowLevel.Encoder encoder = new VCDiffDotNet.LowLevel.Encoder())
            {
                encoder.InitEncoder(sourceFile, true, true, false, false);

                byte[] partialOutput;
                var ret = encoder.StartEncoding(out partialOutput);
                result.AddRange(partialOutput);

                byte[] partOfTargetFile = File.ReadAllBytes(@"C:\tmp\diff\test-new.7z");
                ret = encoder.EncodeChunk(partOfTargetFile, out partialOutput);
                result.AddRange(partialOutput);

                ret = encoder.FinishEncoding(out partialOutput);
                result.AddRange(partialOutput);
            }

            byte[] patchFile = result.ToArray();
            File.WriteAllBytes(@"C:\tmp\diff\test.patch", patchFile);
        }
Example #4
0
        static void EncodingExample()
        {
            byte[]      sourceFile = File.ReadAllBytes(@"C:\tmp\diff\test.7z");
            List <byte> result     = new List <byte>();

            using (VCDiffDotNet.LowLevel.Encoder encoder = new VCDiffDotNet.LowLevel.Encoder())
            {
                encoder.InitEncoder(sourceFile, true, true, false, false);

                byte[] partialOutput;
                var    ret = encoder.StartEncoding(out partialOutput);
                result.AddRange(partialOutput);

                byte[] partOfTargetFile = File.ReadAllBytes(@"C:\tmp\diff\test-new.7z");
                ret = encoder.EncodeChunk(partOfTargetFile, out partialOutput);
                result.AddRange(partialOutput);

                ret = encoder.FinishEncoding(out partialOutput);
                result.AddRange(partialOutput);
            }

            byte[] patchFile = result.ToArray();
            File.WriteAllBytes(@"C:\tmp\diff\test.patch", patchFile);
        }