Ejemplo n.º 1
0
        public void Build()
        {
            if (_context.VersionFrom == _context.VersionTo)
            {
                throw new SameVersionsException();
            }

            _context.LogProgress(string.Format(_context.LocalizedMessages.PatchCollectingDefinitions));
            var fromDefinition = GetBuildDefinition(_context.VersionFrom);
            var toDefinition   = GetBuildDefinition(_context.VersionTo);

            _context.LogProgress(string.Format(_context.LocalizedMessages.PatchCollectingPatchData));
            var patchDefinition = BuildPatchDefinition(fromDefinition, toDefinition);

            _context.LogProgress(string.Format(_context.LocalizedMessages.PatchBuildingPatch, _context.VersionFrom, _context.VersionTo));
            BuildPatch(patchDefinition, fromDefinition, toDefinition);
            FilesManager.DeleteMultiple(_context.Settings.GetPatchesTempFolderPath(), "*.signature");

            _context.LogProgress(string.Format(_context.LocalizedMessages.PatchCompressing, _context.VersionFrom, _context.VersionTo));
            CompressPatch();
            _context.ReportProgress(string.Format(_context.LocalizedMessages.PatchCompressed, _context.VersionFrom, _context.VersionTo));

            _context.LogProgress(string.Format(_context.LocalizedMessages.PatchCleaningWorkspace));
            DirectoriesManager.Delete(_context.Settings.GetPatchesTempFolderPath());
            _context.ReportProgress(string.Format(_context.LocalizedMessages.PatchCleanedWorkspace));

            _context.LogProgress(string.Format(_context.LocalizedMessages.PatchBuildingDefinition));
            BuildPatchDefinition(patchDefinition);
            _context.ReportProgress(string.Format(_context.LocalizedMessages.PatchBuiltDefinition));

            _context.LogProgress(string.Format(_context.LocalizedMessages.PatchBuildingIndex));
            BuildPatchIndex();
            _context.ReportProgress(string.Format(_context.LocalizedMessages.PatchBuiltIndex));
        }
Ejemplo n.º 2
0
        private void PerformUpdate(PatchDefinition definition)
        {
            _context.LogProgress(string.Format(_context.LocalizedMessages.UpdateDownloadingArchive, definition.From, definition.To));
            DownloadPatch(definition);
            _context.ReportProgress(string.Format(_context.LocalizedMessages.UpdateDownloadedArchive, definition.From, definition.To));

            _context.LogProgress(string.Format(_context.LocalizedMessages.UpdateDecompressingArchive, definition.From, definition.To));
            DecompressPatch(definition);
            _context.ReportProgress(string.Format(_context.LocalizedMessages.UpdateDecompressedArchive, definition.From, definition.To));

            foreach (var definitionEntry in definition.Entries)
            {
                ProcessFile(definition, definitionEntry);
            }

            DirectoriesManager.Delete(_context.Settings.GetTempPath());
        }