Example #1
0
        public static void CreateISOMedia(
            string ISOPath,
            string UUPPath,
            string Edition,
            string LanguageCode,
            bool IntegrateUpdates,
            Common.CompressionType CompressionType,
            ProgressCallback progressCallback = null)
        {
            progressCallback?.Invoke(Common.ProcessPhase.ReadingMetadata, true, 0, "Enumerating files");

            var temp = Path.GetTempFileName();

            File.Delete(temp);
            Directory.CreateDirectory(temp);

            string WinREWIMFilePath   = Path.Combine(temp, "Winre.wim");
            string MediaRootPath      = Path.Combine(temp, "MediaRoot");
            string InstallWIMFilePath = CompressionType == Common.CompressionType.LZMS ?
                                        Path.Combine(MediaRootPath, "sources", "install.esd") :
                                        Path.Combine(MediaRootPath, "sources", "install.wim");

            //
            // Build installer
            //
            bool result = SetupMediaCreator.CreateSetupMedia(UUPPath, LanguageCode, MediaRootPath, WinREWIMFilePath, CompressionType, progressCallback);

            if (!result)
            {
                goto error;
            }

            //
            // Build Install.WIM/ESD
            //
            result = BaseEditionBuilder.CreateBaseEdition(UUPPath, LanguageCode, Edition, WinREWIMFilePath, InstallWIMFilePath, CompressionType, progressCallback);
            if (!result)
            {
                goto error;
            }

            //
            // Build ISO
            //
            result = UUPMediaCreator.CreateISO(MediaRootPath, ISOPath, progressCallback);
            if (!result)
            {
                goto error;
            }

            progressCallback?.Invoke(Common.ProcessPhase.Done, true, 0, "");
            goto exit;

error:
            progressCallback?.Invoke(Common.ProcessPhase.Error, true, 0, "");

exit:
            return;
        }
        public static void CreateISOMediaAdvanced(
            string ISOPath,
            string UUPPath,
            string LanguageCode,
            bool IntegrateUpdates,
            Common.CompressionType CompressionType,
            ProgressCallback progressCallback = null)
        {
            bool   result = true;
            string error  = "";

            List <EditionTarget> editionTargets;

            result = GetTargetedPlan(UUPPath, LanguageCode, out editionTargets, progressCallback);
            if (!result)
            {
                error = "An error occurred while getting target plans for the conversion.";
                goto error;
            }

            foreach (var ed in editionTargets)
            {
                foreach (var line in ConversionPlanBuilder.PrintEditionTarget(ed))
                {
                    progressCallback?.Invoke(Common.ProcessPhase.ReadingMetadata, true, 0, line);
                }
            }

            progressCallback?.Invoke(Common.ProcessPhase.ReadingMetadata, true, 0, "Enumerating files");

            var temp = Path.GetTempFileName();

            File.Delete(temp);
            Directory.CreateDirectory(temp);

            string WinREWIMFilePath   = Path.Combine(temp, "Winre.wim");
            string MediaRootPath      = Path.Combine(temp, "MediaRoot");
            string InstallWIMFilePath = CompressionType == Common.CompressionType.LZMS ?
                                        Path.Combine(MediaRootPath, "sources", "install.esd") :
                                        Path.Combine(MediaRootPath, "sources", "install.wim");

            //
            // Build installer
            //
            result = SetupMediaCreator.CreateSetupMedia(UUPPath, LanguageCode, MediaRootPath, WinREWIMFilePath, CompressionType, progressCallback);
            if (!result)
            {
                error = "An error occurred while creating setup media.";
                goto error;
            }

            //
            // Build Install.WIM/ESD
            //
            foreach (var ed in editionTargets)
            {
                result = HandleEditionPlan(ed, UUPPath, MediaRootPath, LanguageCode, InstallWIMFilePath, WinREWIMFilePath, CompressionType, progressCallback: progressCallback);
                if (!result)
                {
                    error = "An error occurred while handling edition plan for the following edition: " + ed.PlannedEdition.EditionName + " available as: " + ed.PlannedEdition.AvailabilityType;
                    goto error;
                }
            }

            BootlegEditionCreator.CleanupLanguagePackFolderIfRequired();

            //
            // Build ISO
            //
            result = UUPMediaCreator.CreateISO(MediaRootPath, ISOPath, progressCallback);
            if (!result)
            {
                error = "An error occurred while creating the ISO.";
                goto error;
            }

            progressCallback?.Invoke(Common.ProcessPhase.Done, true, 0, "");
            goto exit;

error:
            progressCallback?.Invoke(Common.ProcessPhase.Error, true, 0, error);

exit:
            return;
        }
Example #3
0
        public static void CreateISOMedia(
            string ISOPath,
            string UUPPath,
            string Edition,
            string LanguageCode,
            bool IntegrateUpdates,
            Common.CompressionType CompressionType,
            ProgressCallback progressCallback = null)
        {
            string error = "";

            progressCallback?.Invoke(Common.ProcessPhase.ReadingMetadata, true, 0, "Enumerating files");

            var temp = TempManager.TempManager.Instance.GetTempPath();

            Directory.CreateDirectory(temp);

            string WinREWIMFilePath   = Path.Combine(temp, "Winre.wim");
            string MediaRootPath      = Path.Combine(temp, "MediaRoot");
            string InstallWIMFilePath = CompressionType == Common.CompressionType.LZMS ?
                                        Path.Combine(MediaRootPath, "sources", "install.esd") :
                                        Path.Combine(MediaRootPath, "sources", "install.wim");

            //
            // Build installer
            //
            bool result = SetupMediaCreator.CreateSetupMedia(UUPPath, LanguageCode, MediaRootPath, WinREWIMFilePath, CompressionType, progressCallback);

            if (!result)
            {
                error = "An error occurred while creating setup media.";
                goto error;
            }

            //
            // Build Install.WIM/ESD
            //
            result = BaseEditionBuilder.CreateBaseEdition(UUPPath, LanguageCode, Edition, WinREWIMFilePath, InstallWIMFilePath, CompressionType, progressCallback);
            if (!result)
            {
                error = "An error occurred while handling edition plan for the following edition: " + Edition;
                goto error;
            }

            //
            // Build ISO
            //
            result = UUPMediaCreator.CreateISO(MediaRootPath, ISOPath, progressCallback);
            if (!result)
            {
                error = "An error occurred while creating the ISO.";
                goto error;
            }

            progressCallback?.Invoke(Common.ProcessPhase.Done, true, 0, "");
            goto exit;

error:
            progressCallback?.Invoke(Common.ProcessPhase.Error, true, 0, error);

exit:
            return;
        }