Ejemplo n.º 1
0
        /// <summary>
        ///     Searches the computer for all available versions of DISM.
        /// </summary>
        /// <returns>The amount found.</returns>
        public static int Load()
        {
            new DismFile(Directories.System32 + "\\Dism.exe", DismType.System);

            if (!string.IsNullOrWhiteSpace(Options.CustomDismLocation))
            {
                foreach (var dism in Options.CustomDismLocation.Split('|'))
                {
                    new DismFile(dism, DismType.Custom);
                }
            }

            if (OS.Architecture == Architecture.X64)
            {
                new DismFile(Directories.ProgramFiles +
                             "Windows Kits\\8.1\\Assessment and Deployment Kit\\Deployment Tools\\amd64\\DISM\\dism.exe");
                new DismFile(Directories.ProgramFiles +
                             "Windows Kits\\8.0\\Assessment and Deployment Kit\\Deployment Tools\\amd64\\DISM\\dism.exe");
                new DismFile(Directories.ProgramFilesX86 +
                             "Windows Kits\\8.1\\Assessment and Deployment Kit\\Deployment Tools\\amd64\\DISM\\dism.exe");
                new DismFile(Directories.ProgramFilesX86 +
                             "Windows Kits\\8.0\\Assessment and Deployment Kit\\Deployment Tools\\amd64\\DISM\\dism.exe");
                new DismFile(Directories.ProgramFilesX86 +
                             "Windows Kits\\10\\Assessment and Deployment Kit\\Deployment Tools\\amd64\\DISM\\dism.exe");

                new DismFile(Directories.ProgramFiles + "Windows AIK\\Tools\\amd64\\Servicing\\Dism.exe");
            }
            else
            {
                new DismFile(Directories.ProgramFiles +
                             "Windows Kits\\8.1\\Assessment and Deployment Kit\\Deployment Tools\\x86\\DISM\\dism.exe");
                new DismFile(Directories.ProgramFiles +
                             "Windows Kits\\8.0\\Assessment and Deployment Kit\\Deployment Tools\\x86\\DISM\\dism.exe");
                new DismFile(Directories.ProgramFiles +
                             "Windows Kits\\10\\Assessment and Deployment Kit\\Deployment Tools\\x86\\DISM\\dism.exe");

                new DismFile(Directories.ProgramFiles + "Windows AIK\\Tools\\Servicing\\Dism.exe");
                new DismFile(Directories.ProgramFiles + "Windows AIK\\Tools\\x86\\Servicing\\Dism.exe");
                new DismFile(Directories.ProgramFiles + "Win8Dism\\Dism.exe");
            }

            if (available.Count > 0)
            {
                available.Sort((v1, v2) => v1.Version.CompareTo(v2.Version));
                available.Reverse();

                var paths = available.Select(t => Path.GetDirectoryName(t.Location)).ToList();
                Misc.AddEnvironmentPaths(paths);
            }

            return(available.Count);
        }