コード例 #1
0
ファイル: CompDBExtensions.cs プロジェクト: johnwtt/UUP
        public static CompDBXmlClass.Package GetEditionPackFromCompDBs(this IEnumerable <CompDBXmlClass.CompDB> compDBs)
        {
            HashSet <CompDBXmlClass.Package> pkgs = new HashSet <CompDBXmlClass.Package>();

            //
            // Get base editions that are available with all their files
            //
            HashSet <CompDBXmlClass.CompDB> filteredCompDBs = compDBs.GetEditionCompDBs();

            if (filteredCompDBs.Count() > 0)
            {
                foreach (var compDB in filteredCompDBs)
                {
                    foreach (CompDBXmlClass.Package feature in filteredCompDBs.First().Features.Feature[0].Packages.Package)
                    {
                        CompDBXmlClass.Package pkg = filteredCompDBs.First().Packages.Package.First(x => x.ID == feature.ID);

                        string file = pkg.Payload.PayloadItem.Path;

                        if (!file.EndsWith(".esd", StringComparison.InvariantCultureIgnoreCase) ||
                            !file.Contains("microsoft-windows-editionspecific", StringComparison.InvariantCultureIgnoreCase) ||
                            file.Contains("WOW64", StringComparison.InvariantCultureIgnoreCase) ||
                            file.Contains("arm64.arm", StringComparison.InvariantCultureIgnoreCase))
                        {
                            // We do not care about this file
                            continue;
                        }

                        pkgs.Add(pkg);
                    }
                }
            }

            CompDBXmlClass.Package minpkg = null;
            if (pkgs.Count > 0)
            {
                foreach (var pkg in pkgs)
                {
                    if (minpkg == null)
                    {
                        minpkg = pkg;
                    }
                    else if (ulong.Parse(minpkg.Payload.PayloadItem.PayloadSize) > ulong.Parse(pkg.Payload.PayloadItem.PayloadSize))
                    {
                        minpkg = pkg;
                    }
                }
            }

            return(minpkg);
        }
コード例 #2
0
ファイル: CompDBExtensions.cs プロジェクト: johnwtt/UUP
 public static string GetCommonlyUsedIncorrectFileName(this CompDBXmlClass.Package pkg)
 {
     return(pkg.Payload.PayloadItem.Path.Split('\\').Last().Replace("~31bf3856ad364e35", "").Replace("~.", ".").Replace("~", "-").Replace("-.", "."));
 }