Skip to content

Commit 051718f

Browse files
committed
Add PatchEnabled flag to update strategies
Introduces the PatchEnabled flag to both LinuxStrategy and WindowsStrategy, passing it through the pipeline context. CompressMiddleware now uses PatchEnabled to determine the correct decompression path, improving conditional patch handling.
1 parent bf620cf commit 051718f

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

src/c#/GeneralUpdate.ClientCore/Strategys/LinuxStrategy.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,14 @@ public override async Task ExecuteAsync()
4848
//patch middleware
4949
context.Add("SourcePath", _configinfo.InstallPath);
5050
context.Add("PatchPath", patchPath);
51+
context.Add("PatchEnabled", _configinfo.PatchEnabled);
52+
//blacklist
5153
context.Add("BlackFiles", _configinfo.BlackFiles);
5254
context.Add("BlackFileFormats", _configinfo.BlackFormats);
5355
context.Add("SkipDirectorys", _configinfo.SkipDirectorys);
54-
56+
5557
var pipelineBuilder = new PipelineBuilder(context)
56-
.UseMiddleware<PatchMiddleware>()
58+
.UseMiddlewareIf<PatchMiddleware>(_configinfo.PatchEnabled)
5759
.UseMiddleware<CompressMiddleware>()
5860
.UseMiddleware<HashMiddleware>();
5961
await pipelineBuilder.Build();

src/c#/GeneralUpdate.Core/Pipeline/CompressMiddleware.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ public Task InvokeAsync(PipelineContext context)
1515
var sourcePath = context.Get<string>("ZipFilePath");
1616
var patchPath = context.Get<string>("PatchPath");
1717
var encoding = context.Get<Encoding>("Encoding");
18-
CompressProvider.Decompress(format, sourcePath, patchPath, encoding);
18+
var appPath = context.Get<string>("SourcePath");
19+
var patchEnabled = context.Get<bool?>("PatchEnabled");
20+
21+
CompressProvider.Decompress(format, sourcePath,patchEnabled == false ? appPath : patchPath, encoding);
1922
});
2023
}
2124
}

src/c#/GeneralUpdate.Core/Strategys/WindowsStrategy.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public override void Execute()
5050
//Patch middleware
5151
context.Add("SourcePath", _configinfo.InstallPath);
5252
context.Add("PatchPath", patchPath);
53+
context.Add("PatchEnabled", _configinfo.PatchEnabled);
5354
//Driver middleware
5455
if (_configinfo.DriveEnabled == true)
5556
{

0 commit comments

Comments
 (0)