Exemple #1
0
        public PatchIndexes Find()
        {
            var result = new PatchIndexes();

            using (var stream = File.OpenRead(_fileName))
            {
                result.OriginalIndex = IndexOf(stream, _originalPattern);
                stream.Seek(0, SeekOrigin.Begin);
                result.PatchIndex = IndexOf(stream, _patchPattern);
            }

            return(result);
        }
Exemple #2
0
        public bool Patch(PatchIndexes patch)
        {
            if (patch.OriginalIndex > 0)
            {
                UpdateFile(patch.OriginalIndex, _patchPattern);
                return(true);
            }

            if (patch.PatchIndex > 0)
            {
                UpdateFile(patch.PatchIndex, _originalPattern);
            }

            return(false);
        }