1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
|
// Copyright (c) .NET Foundation and contributors. All rights reserved. Licensed under the Microsoft Reciprocal License. See LICENSE.TXT file in the project root for full license information.
namespace WixToolset.Core.WindowsInstaller.Bind
{
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using WixToolset.Core.Bind;
using WixToolset.Data;
using WixToolset.Data.Tuples;
/// <summary>
/// Creates delta patches and updates the appropriate rows to point to the newly generated patches.
/// </summary>
internal class CreateDeltaPatchesCommand
{
public CreateDeltaPatchesCommand(List<FileFacade> fileFacades, string intermediateFolder, WixPatchIdTuple wixPatchId)
{
this.FileFacades = fileFacades;
this.IntermediateFolder = intermediateFolder;
this.WixPatchId = wixPatchId;
}
private IEnumerable<FileFacade> FileFacades { get; }
private WixPatchIdTuple WixPatchId { get; }
private string IntermediateFolder { get; }
public void Execute()
{
var optimizePatchSizeForLargeFiles = this.WixPatchId?.OptimizePatchSizeForLargeFiles ?? false;
var apiPatchingSymbolFlags = (PatchSymbolFlagsType)(this.WixPatchId?.ApiPatchingSymbolFlags ?? 0);
#if REVISIT_FOR_PATCHING
foreach (FileFacade facade in this.FileFacades)
{
if (RowOperation.Modify == facade.File.Operation &&
0 != (facade.WixFile.PatchAttributes & PatchAttributeType.IncludeWholeFile))
{
string deltaBase = String.Concat("delta_", facade.File.File);
string deltaFile = Path.Combine(this.IntermediateFolder, String.Concat(deltaBase, ".dpf"));
string headerFile = Path.Combine(this.IntermediateFolder, String.Concat(deltaBase, ".phd"));
bool retainRangeWarning = false;
if (PatchAPI.PatchInterop.CreateDelta(
deltaFile,
facade.WixFile.Source,
facade.DeltaPatchFile.Symbols,
facade.DeltaPatchFile.RetainOffsets,
new[] { facade.WixFile.PreviousSource },
facade.DeltaPatchFile.PreviousSymbols.Split(new[] { ';' }),
facade.DeltaPatchFile.PreviousIgnoreLengths.Split(new[] { ';' }),
facade.DeltaPatchFile.PreviousIgnoreOffsets.Split(new[] { ';' }),
facade.DeltaPatchFile.PreviousRetainLengths.Split(new[] { ';' }),
facade.DeltaPatchFile.PreviousRetainOffsets.Split(new[] { ';' }),
apiPatchingSymbolFlags,
optimizePatchSizeForLargeFiles,
out retainRangeWarning))
{
PatchAPI.PatchInterop.ExtractDeltaHeader(deltaFile, headerFile);
facade.WixFile.Source = deltaFile;
facade.WixFile.DeltaPatchHeaderSource = headerFile;
}
if (retainRangeWarning)
{
// TODO: get patch family to add to warning message for PatchWiz parity.
Messaging.Instance.OnMessage(WixWarnings.RetainRangeMismatch(facade.File.SourceLineNumbers, facade.File.File));
}
}
}
#endif
throw new NotImplementedException();
}
}
}
|