/// <summary> /// Either installs or integrate the update to the live OS or image. /// </summary> /// <param name="LDR">Install LDR or GDR.</param> /// <returns></returns> private Status DoWork(Task task, string mountPath, bool LDR) { if (_progressBar == null) { _progressBar = new ProgressBar(); } _progressBar.Value = 0; Status = Status.Working; // if (CheckIntegration(mountPath, LDR)) { return Status.Success; } if (task == Task.Install) { using (var session = DismApi.OpenOnlineSession()) { DismApi.AddPackage(session, Location, true, false, delegate(DismProgress progress) { _progressBar.Value = progress.Current; }); } // Processes.Run("pkgmgr.exe", "/ip /m:\"" + Location + "\" /quiet /norestart"); } else { Processes.Run(DISM.Default.Location, "/Image:\"" + mountPath + "\" /Add-Package /Packagepath:\"" + Location + "\""); } if (LDR && (_updateType == UpdateType.Unknown || _updateType == UpdateType.LDR)) { if (CheckIntegration(mountPath)) { return(Status.Failed); } Extraction.Expand(Location, _tempLocation); _updateType = UpdateType.GDR; if (File.Exists(_tempLocation + "\\update-bf.mum")) { _updateType = UpdateType.LDR; if (task == Task.Install) { Processes.Run("pkgmgr.exe", "/ip /m:\"" + _tempLocation + "\\update-bf.mum" + "\" /quiet /norestart"); } else { var s = Processes.Run("DISM", "/Image:\"" + mountPath + "\" /Add-Package /Packagepath:\"" + _tempLocation + "\\update-bf.mum" + "\""); MessageBox.Show(s); } } FileHandling.DeleteDirectory(_tempLocation); } UpdateCache.Add(this); if (_updateType != UpdateType.LDR) { LDR = false; } if (CheckIntegration(mountPath, LDR)) { return(Status.Success); } return(Status.Failed); }