Skip to content

Commit 401e7fd

Browse files
authored
Merge branch 'script' into copilot/sub-pr-95
2 parents a81ce0b + ef74f98 commit 401e7fd

2 files changed

Lines changed: 31 additions & 4 deletions

File tree

src/c#/GeneralUpdate.Common/Internal/Bootstrap/UpdateOption.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ private class UpdateOptionPool : ConstantPool
4949
public static readonly UpdateOption<bool?> BackUp = ValueOf<bool?>("BACKUP");
5050

5151
/// <summary>
52-
/// Whether to enable the backup function.
52+
/// Specifies the update execution mode.
5353
/// </summary>
5454
public static readonly UpdateOption<UpdateMode?> Mode = ValueOf<UpdateMode?>("MODE");
5555

src/c#/GeneralUpdate.Core/GeneralUpdateBootstrap.cs

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,27 @@ public GeneralUpdateBootstrap SetConfig(Configinfo configInfo)
7878
UpdateUrl = configInfo.UpdateUrl,
7979
Scheme = configInfo.Scheme,
8080
Token = configInfo.Token,
81+
ProductId = configInfo.ProductId,
8182
DriveEnabled = GetOption(UpdateOption.Drive) ?? false,
8283
PatchEnabled = GetOption(UpdateOption.Patch) ?? true,
8384
Script = configInfo.Script
8485
};
8586

87+
// Copy blacklist-related configuration if explicitly provided.
88+
if (configInfo.BlackFiles != null)
89+
{
90+
_configInfo.BlackFiles = configInfo.BlackFiles;
91+
}
92+
93+
if (configInfo.BlackFormats != null)
94+
{
95+
_configInfo.BlackFormats = configInfo.BlackFormats;
96+
}
97+
98+
if (configInfo.SkipDirectorys != null)
99+
{
100+
_configInfo.SkipDirectorys = configInfo.SkipDirectorys;
101+
}
86102
InitBlackList();
87103
return this;
88104
}
@@ -93,9 +109,8 @@ public GeneralUpdateBootstrap SetFieldMappings(Dictionary<string, string> fieldM
93109
return this;
94110
}
95111

96-
public GeneralUpdateBootstrap SetCustomSkipOption(Func<bool> func)
112+
public GeneralUpdateBootstrap SetCustomSkipOption(Func<bool>? func)
97113
{
98-
Debug.Assert(func != null);
99114
_customSkipOption = func;
100115
return this;
101116
}
@@ -246,8 +261,20 @@ private void InitBlackList()
246261
}
247262

248263
private bool CanSkip(bool isForcibly)
249-
=> !isForcibly && _customSkipOption?.Invoke() == true;
264+
{
265+
if (isForcibly)
266+
{
267+
return false;
268+
}
250269

270+
// Treat a null custom skip option as "do not skip".
271+
if (_customSkipOption is null)
272+
{
273+
return false;
274+
}
275+
276+
return _customSkipOption();
277+
}
251278
private static bool CheckUpgrade(VersionRespDTO? response)
252279
=> response?.Code == 200 && response.Body?.Count > 0;
253280

0 commit comments

Comments
 (0)