Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6370333

Browse files
committed
fix: compdbs including multiple different paths to same file binaries
1 parent9726056 commit6370333

File tree

1 file changed

+28
-27
lines changed

1 file changed

+28
-27
lines changed

‎src/UnifiedUpdatePlatform.Services.WindowsUpdate.Downloads.Shared/DownloadHelpers.cs‎

Lines changed: 28 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,20 @@ namespace UnifiedUpdatePlatform.Services.WindowsUpdate.Downloads
3434
{
3535
publicstaticclassUpdateUtils
3636
{
37-
publicstaticstringGetFilenameForCEUIFile(CExtendedUpdateInfoXml.Filefile2,IEnumerable<CompDBXmlClass.PayloadItem>payloadItems)
37+
publicstaticstring[]GetFilenameForCEUIFile(CExtendedUpdateInfoXml.Filefile2,IEnumerable<CompDBXmlClass.PayloadItem>payloadItems)
3838
{
3939
stringfilename=file2.FileName.Replace('\\',Path.DirectorySeparatorChar);
4040
if(payloadItems.Any(x=>x.PayloadHash==file2.AdditionalDigest.Text||x.PayloadHash==file2.Digest))
4141
{
42-
CompDBXmlClass.PayloadItempayload=payloadItems.First(x=>x.PayloadHash==file2.AdditionalDigest.Text||x.PayloadHash==file2.Digest);
43-
returnpayload.Path.Replace('\\',Path.DirectorySeparatorChar);
42+
IEnumerable<CompDBXmlClass.PayloadItem>payloads=payloadItems.Where(x=>x.PayloadHash==file2.AdditionalDigest.Text||x.PayloadHash==file2.Digest);
43+
returnpayloads.Select(p=>p.Path.Replace('\\',Path.DirectorySeparatorChar)).ToArray();
4444
}
4545
elseif(!payloadItems.Any()&&filename.Contains('_')&&!filename.StartsWith("_")&&(!filename.Contains('-')||filename.IndexOf('-')>filename.IndexOf('_')))
4646
{
4747
filename=filename[..filename.IndexOf('_')]+Path.DirectorySeparatorChar+filename[(filename.IndexOf('_')+1)..];
48-
returnfilename.TrimStart(Path.DirectorySeparatorChar);
48+
returnnewstring[]{filename.TrimStart(Path.DirectorySeparatorChar)};
4949
}
50-
returnfilename;
50+
returnnewstring[]{filename};
5151
}
5252

5353
publicstaticboolShouldFileGetDownloaded(CExtendedUpdateInfoXml.Filefile2,IEnumerable<CompDBXmlClass.PayloadItem>payloadItems)
@@ -192,7 +192,7 @@ private static
192192

193193
foreach(CompDBXmlClass.CompDBcdbinselectedCompDBs)
194194
{
195-
if(cdb==AppCompDBs||cdb.Packages==null)
195+
if(AppCompDBs.Contains(cdb)||cdb.Packages==null)
196196
{
197197
continue;
198198
}
@@ -233,7 +233,7 @@ private static
233233

234234
foreach(CompDBXmlClass.CompDBcdbindiscardedCompDBs)
235235
{
236-
if(cdb==AppCompDBs||cdb.Packages==null)
236+
if(AppCompDBs.Contains(cdb)||cdb.Packages==null)
237237
{
238238
continue;
239239
}
@@ -543,36 +543,37 @@ await Task.WhenAll(
543543
//.Where(x => UpdateUtils.ShouldFileGetDownloaded(x.x, payloadItems))
544544
.OrderBy(x=>x.Item2.ExpirationDate);
545545

546-
IEnumerable<UUPFile>fileList=boundList.Select(boundFile=>
546+
IEnumerable<UUPFile>fileList=boundList.SelectMany(boundFile=>
547547
{
548-
stringpath=GetFilenameForCEUIFile(boundFile.Item1,payloadItems);
549-
550-
try
548+
returnGetFilenameForCEUIFile(boundFile.Item1,payloadItems).Select(path=>
551549
{
552-
foreach(CompDBXmlClass.CompDBcompDbincompDBs)
550+
try
553551
{
554-
foreach(CompDBXmlClass.PackagepkgincompDb.Packages.Package)
552+
foreach(CompDBXmlClass.CompDBcompDbincompDBs)
555553
{
556-
stringpayloadHash=pkg.Payload.PayloadItem[0].PayloadHash;
557-
if(payloadHash==boundFile.Item1.AdditionalDigest.Text||payloadHash==boundFile.Item1.Digest)
554+
foreach(CompDBXmlClass.PackagepkgincompDb.Packages.Package)
558555
{
559-
if(pkg.ID.Contains("-")&&pkg.ID.Contains(".inf",StringComparison.InvariantCultureIgnoreCase))
556+
stringpayloadHash=pkg.Payload.PayloadItem[0].PayloadHash;
557+
if(payloadHash==boundFile.Item1.AdditionalDigest.Text||payloadHash==boundFile.Item1.Digest)
560558
{
561-
path=pkg.ID.Split("-")[1].Replace(".inf",".cab").Replace(".INF",".CAB");
559+
if(pkg.ID.Contains("-")&&pkg.ID.Contains(".inf",StringComparison.InvariantCultureIgnoreCase))
560+
{
561+
path=pkg.ID.Split("-")[1].Replace(".inf",".cab").Replace(".INF",".CAB");
562+
}
563+
break;
562564
}
563-
break;
564565
}
565566
}
566567
}
567-
}
568-
catch{}
569-
570-
returnnewUUPFile(
571-
boundFile.Item2,
572-
path,
573-
long.Parse(boundFile.Item1.Size),
574-
boundFile.Item1.AdditionalDigest.Text,
575-
boundFile.Item1.AdditionalDigest.Algorithm);
568+
catch{}
569+
570+
returnnewUUPFile(
571+
boundFile.Item2,
572+
path,
573+
long.Parse(boundFile.Item1.Size),
574+
boundFile.Item1.AdditionalDigest.Text,
575+
boundFile.Item1.AdditionalDigest.Algorithm);
576+
});
576577
});
577578

578579
returnCode=awaithelperDl.DownloadAsync(fileList.ToList(),generalDownloadProgress)?0:-1;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp