コード例 #1
0
            public static void ReinstallGlobalPackage(string UID, string _namespace, out LogDataList log)
            {
                if (GlobalPackages == null)
                {
                    try
                    {
                        throw new InstalledPackageNotFoundException(ExceptionMessages.General.PackWIDNotFound(UID));
                    }
                    catch (Exception ex)
                    {
                        Logger.WriteErrorLog(LoggerMessages.PackageManagement.Reinstaller.Error.PackageMissng(UID), _namespace, ex, BasicDebugLogger.DebugErrorType.Error);
                        throw;
                    }
                }
                InstalledPackage foundInstalledPackage = GlobalPackages.FindByUID(UID);

                if (foundInstalledPackage == null)
                {
                    try
                    {
                        throw new InstalledPackageNotFoundException(ExceptionMessages.General.PackWIDNotFound(UID));
                    }
                    catch (Exception ex)
                    {
                        Logger.WriteErrorLog(LoggerMessages.PackageManagement.Reinstaller.Error.PackageMissng(UID), _namespace, ex, BasicDebugLogger.DebugErrorType.Error);
                        throw;
                    }
                }
                ReinstallGlobalPackage(foundInstalledPackage, _namespace, out log);
            }
コード例 #2
0
        public static void InitializePackageManagement(this frmMain form)
        {
            string _namespace = MethodBase.GetCurrentMethod().ToLogFormatFullName();

            string[] directories = null;
            try
            {
                directories = Directory.GetDirectories(PMFileSystem.PackMan_ManDir);
            }
            catch (Exception ex)
            {
                Helper.ShowMessageBox(MessageBoxStrings.PackageManagement.INIT_GLOBAL_GET_DIRS_ERROR, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Error);
                Logger.WriteErrorLog(LoggerMessages.PackageManagement.GLOBAL_DIR_ERROR + PMFileSystem.PackMan_ManDir + ".", _namespace, ex, BasicDebugLogger.DebugErrorType.Error);
                return;
            }
            if (directories == null || directories.Length == 0)
            {
                return;
            }

            LogDataList log = new LogDataList();


            foreach (string directory in directories)
            {
                LogDataList outLog = null;
                try
                {
                    GlobalPackages.AddSafely(new InstalledPackage(directory, _namespace, out outLog));
                }
                catch (Exception ex)
                {
                    log.WriteWarningLog(LoggerMessages.PackageManagement.InstalledPackage.Error.ErrorTryLoad(directory), _namespace, ex);
                    if (ex is InvalidInstalledPackageFile castedEx)
                    {
                        log.WriteErrorLog(castedEx.Message, _namespace, castedEx.InnerException);
                    }
                    else
                    {
                        log.WriteErrorLog(ex.Message, _namespace, ex);
                    }
                }
                log.AppendLogs(outLog);
            }
            if (log.HasErrorsOrWarnings())
            {
                Helper.ShowMessageBox(MessageBoxStrings.PackageManagement.INIT_ERROR_WARNS_FOUND, MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
            else
            {
                Logger.WriteInformationLog(LoggerMessages.PackageManagement.INIT_GLOBAL_DIR + PMFileSystem.PackMan_ManDir + ".", _namespace);
            }
        }
コード例 #3
0
        public static void MakeInstalledPackageFileForDefPackage(string XmlPath, string _namespace, out LogDataList log, string rootDirectory = null, bool ignoreClash = false)
        {
            log = new LogDataList();
            log.WriteInformationLog(MakeInstalledPackagesMessages.Info.CreateInstalledPack(XmlPath, rootDirectory), _namespace);
            LogDataList outLog  = null;
            RMPackage   newPack = null;
            Exception   exResult;

            try
            {
                newPack = new RMPackage(XmlPath, _namespace, out outLog, rootDirectory);
            }
            catch (Exception ex)
            {
                log.AppendLogs(outLog);
                Logger.WriteErrorLog(MakeInstalledPackagesMessages.Error.InvalidXML(XmlPath, rootDirectory), _namespace, ex, BasicDebugLogger.DebugErrorType.Error);
                throw;
            }
            log.AppendLogs(outLog);

            string origDir = newPack.XMLDirectory;

            InstalledPackage installedPackage = GlobalPackages.FindByUID(newPack.UniqueID);
            string           newPackDir       = PMFileSystem.PackMan_ManDir + "\\" + newPack.UniqueIDInMD5;

            if (installedPackage != null)
            {
                if (ignoreClash)
                {
                    Logger.WriteWarningLog(MakeInstalledPackagesMessages.Warning.InstalledPackExistsExit(newPack.Name), _namespace, null);
                    return;
                }
                else
                {
                    log.WriteWarningLog(MakeInstalledPackagesMessages.Warning.InstalledPackExistsReplace(newPack.Name), _namespace);
                    if (Helper.DeleteFolderSafely(newPackDir, _namespace, out exResult, new DeleteFolderLogMessages(deleteFailed: MakeInstalledPackagesMessages.Error.UnableToDeleteExistingFolder)) == DeleteFolderResult.UserCancelled)
                    {
                        throw exResult;
                    }
                }
            }



            string tempPackDir = PMFileSystem.PackMan_TempDir + "\\" + newPack.UniqueIDInMD5;

            if (Helper.DeleteFolderSafely(tempPackDir, _namespace, out exResult, LoggerMessages.GeneralError.UNABLE_DELETE_TEMP_DIR_ARG) == DeleteFolderResult.UserCancelled)
            {
                throw exResult;
            }

            if (Helper.CreateFolderSafely(newPackDir, _namespace, out exResult, new CreateFolderLogMessages(createFailed: MakeInstalledPackagesMessages.Error.UnableCreateRootDir)) == CreateFolderResult.UserCancelled)
            {
                throw exResult;
            }

            if (Helper.CreateFolderSafely(tempPackDir, _namespace, out exResult, LoggerMessages.GeneralError.UNABLE_CREATE_TEMP_DIR_ARG) == CreateFolderResult.UserCancelled)
            {
                throw exResult;
            }

            string backupXMLInstallerPath = tempPackDir + "\\" + Vars.INSTALL_FILE_DEFAULT_FILENAME;



            makeInstPackageAnon onErrorBackup = delegate()
            {
                if (Helper.ShowMessageBox(MessageBoxStrings.PackageManagement.FailedMakeInstallPackageArch(newPack.Name), MessageBoxStrings.MESSAGEBOX_NAME, MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    return(true);
                }

                Logger.WriteErrorLog(MakeInstalledPackagesMessages.Error.UserRequiredOnFailedBackUpNo(newPack.Name), _namespace, null, BasicDebugLogger.DebugErrorType.Error);
                Helper.DeleteFolderSafely(tempPackDir, _namespace, out exResult, LoggerMessages.GeneralError.UNABLE_DELETE_TEMP_DIR_ARG);
                Helper.DeleteFolderSafely(newPackDir, _namespace, out exResult, LoggerMessages.GeneralError.UNABLE_DELETE_UNUSED_DIR_ARG);
                return(false);
            };



            string rootPathOfFiles;

            if (rootDirectory == null)
            {
                rootPathOfFiles = newPack.XMLDirectory;
            }
            else
            {
                rootPathOfFiles = rootDirectory;
            }

            PackageUtil.ExplicitCopyAssetsAndLicFileTo(newPack, rootPathOfFiles, tempPackDir, _namespace);

            try
            {
                newPack.SaveToFile(backupXMLInstallerPath, _namespace, RMPackage.SaveToFileMode.ImplicitAssetInfo,
                                   logMessage: new WriteAllTextLogMessages(writeFailed: MakeInstalledPackagesMessages.Error.UnableCreateInstXML, logGroup: log));
            }
            catch
            {
                if (onErrorBackup())
                {
                    goto onerrorContinue;
                }
                throw;
            }

            string archDest = newPackDir + "\\" + Vars.INSTALLED_ARCH_FILENAME;

            try
            {
                ArchiveManagement.CreateNewZip(tempPackDir, archDest, _namespace);
            }
            catch (Exception ex)
            {
                log.WriteWarningLog(MakeInstalledPackagesMessages.Error.UnableMakeBackup(newPack.Name, tempPackDir, archDest), _namespace, ex);
                if (onErrorBackup())
                {
                    goto onerrorContinue;
                }
                throw;
            }

onerrorContinue:
            //newPack.Installed = true;
            //newPack.SetInstalledPropertyAll(RMPackObject.InstallStatus.Installed);

            if (newPack.License != null && newPack.License.LicenseSource == RMPackLic.Source.File && RMPackLic.IsAValidLicenseSourceFile(newPack.License.Data, origDir))
            {
                string         licSourcePath = origDir + "\\" + newPack.License.Data;
                string         fileName      = Path.GetFileName(licSourcePath);
                string         destPath      = newPackDir + "\\" + fileName;
                CopyFileResult copyRes       = Helper.CopyFileSafely(licSourcePath, destPath, true, _namespace, out exResult, new CopyFileLogMessages(copyFileFailed: MakeInstalledPackagesMessages.Error.UnableCopyLicenseFile));
                if (copyRes == CopyFileResult.UserCancelled || copyRes == CopyFileResult.SourceFileNotFound)
                {
                    Helper.DeleteFolderSafely(tempPackDir, _namespace, out exResult, LoggerMessages.GeneralError.UNABLE_DELETE_TEMP_DIR_ARG);
                    Helper.DeleteFolderSafely(newPackDir, _namespace, out exResult, LoggerMessages.GeneralError.UNABLE_DELETE_UNUSED_DIR_ARG);
                    throw exResult;
                }
                newPack.License.Data = fileName;
            }
            string installedXMLDest = newPackDir + "\\" + Vars.INSTALLED_XML_FILENAME;

            newPack.Implicit = false;
            try
            {
                newPack.SaveToFile(installedXMLDest, _namespace, RMPackage.SaveToFileMode.ExplicitAssetInfo,
                                   logMessage: new WriteAllTextLogMessages(writeFailed: MakeInstalledPackagesMessages.Error.UnableMakeMainXML));
            }
            catch
            {
                Helper.DeleteFolderSafely(tempPackDir, _namespace, out exResult, LoggerMessages.GeneralError.UNABLE_DELETE_TEMP_DIR_ARG);
                Helper.DeleteFolderSafely(newPackDir, _namespace, out exResult, LoggerMessages.GeneralError.UNABLE_DELETE_UNUSED_DIR_ARG);
                throw;
            }

            try
            {
                GlobalPackages.AddSafely(new InstalledPackage(newPackDir, _namespace, out outLog));
            }
            catch (Exception ex)
            {
                log.WriteWarningLog(LoggerMessages.PackageManagement.InstalledPackage.Error.ErrorTryLoad(newPackDir), _namespace, ex);
                if (ex is InvalidInstalledPackageFile castedEx)
                {
                    log.WriteErrorLog(castedEx.Message, _namespace, castedEx.InnerException);
                }
                else
                {
                    log.WriteErrorLog(ex.Message, _namespace, ex);
                }
            }
            log.AppendLogs(outLog);

            try
            {
                NewProject.CopyPackageInstallInfo(tempPackDir, _namespace, out outLog);
            }
            catch (Exception ex)
            {
                log.WriteWarningLog(MakeInstalledPackagesMessages.Warning.UnableCopyNewProj(newPack.Name, newPackDir), _namespace, ex);
            }
            log.AppendLogs(outLog);


            Helper.DeleteFolderSafely(tempPackDir, _namespace, out exResult, LoggerMessages.GeneralError.UNABLE_DELETE_TEMP_DIR_ARG);
            log.WriteInformationLog(MakeInstalledPackagesMessages.Info.SUCCESS_CREATE + newPack.Name + ".", _namespace);
        }
コード例 #4
0
            public static void UninstallGlobalPackage(string arg, string _namespace, out LogDataList log, UninstallArgType argType = UninstallArgType.UID, bool renumberParts = true, bool deleteInstallFiles = true, bool procEvents = true)
            {
                log = new LogDataList();
                Logger.WriteInformationLog(UninstallerMessages.Information.UNINSTALL_PACKAGE_START_G, _namespace);


                if (string.IsNullOrWhiteSpace(arg))
                {
                    try
                    {
                        throw new ArgumentNullException(ExceptionMessages.General.ARG_ARG_NULL);
                    }
                    catch (Exception ex)
                    {
                        Logger.WriteErrorLog(UninstallerMessages.Error.ARG_INVALID, _namespace, ex, BasicDebugLogger.DebugErrorType.Error);
                        throw;
                    }
                }

                if (argType == UninstallArgType.DirectoryPath)
                {
                    arg += "\\" + Vars.INSTALLED_XML_FILENAME;
                }

                if ((argType == UninstallArgType.XMLPath || argType == UninstallArgType.DirectoryPath) && !File.Exists(arg))
                {
                    try
                    {
                        throw new FileNotFoundExceptionWPath(arg);
                    }
                    catch (Exception ex)
                    {
                        Logger.WriteErrorLog(UninstallerMessages.Error.XML_FILE_NOT_FOUND, _namespace, ex, BasicDebugLogger.DebugErrorType.Error);
                        throw;
                    }
                }

                Exception       outEx;
                LogDataList     outLog = null;
                UninstallResult result = UninstallResult.normal;

                if (GlobalPackages != null)
                {
                    InstalledPackage installedPackage;
                    if (argType == UninstallArgType.XMLPath || argType == UninstallArgType.DirectoryPath)
                    {
                        installedPackage = GlobalPackages.FindByPath(arg);
                    }
                    else
                    {
                        installedPackage = GlobalPackages.FindByUID(arg);
                    }

                    if (installedPackage != null)
                    {
                        if (installedPackage.Package != null)
                        {
                            if (procEvents && OnPackageUninstallBegin != null)
                            {
                                OnPackageUninstallBegin.Invoke(installedPackage.Package, true, installedPackage.Directory, installedPackage, null);
                            }

                            result = UninstallPackage(installedPackage.Package, _namespace, out outLog);
                            log.AppendLogs(outLog);

                            if (procEvents && OnPackageUninstalled != null)
                            {
                                OnPackageUninstalled.Invoke(installedPackage.Package, true, installedPackage, null);
                            }
                        }
                        else
                        {
                            result = ProcDelNonReadXMLPackage(arg, installedPackage.Directory, installedPackage, null, _namespace, out outLog, procEvents, argType);
                            log.AppendLogs(outLog);
                        }
                        if (deleteInstallFiles)
                        {
                            if (Directory.Exists(installedPackage.Directory))
                            {
                                string MD5INUID = new DirectoryInfo(installedPackage.Directory).Name;
                                Helper.DeleteFolderSafely(installedPackage.Directory, _namespace, out outEx, new DeleteFolderLogMessages(deleteFailed: UninstallerMessages.Warning.DirectoryUnableDelete, logGroup: log));
                                NewProject.DeletePackageInstallInfo(MD5INUID, _namespace);
                            }

                            GlobalPackages.Remove(installedPackage);
                        }
                        //else
                        //{
                        //    if (installedPackage.Package != null)
                        //    {
                        //        installedPackage.Installed = false;
                        //        bool successfulCopy = true;
                        //        try
                        //        {
                        //            installedPackage.Package.SaveToFile(installedPackage.XMLPath, _namespace, RMPackage.SaveToFileMode.ExplicitAssetInfo);

                        //        }
                        //        catch (Exception ex)
                        //        {
                        //            log.DataList.Add(new RMLogDataWarning(UninstallerMessages.Warning.InstalledXMLUpdateFailedInsStatus(installedPackage.XMLPath), _namespace, ex));
                        //            successfulCopy = false;
                        //        }
                        //        if (successfulCopy)
                        //            NewProject.CopyPackageInstallXML(installedPackage.XMLPath, _namespace, installedPackage.Package);
                        //    }
                        //}
                    }
                    else
                    {
                        if (argType == UninstallArgType.UID)
                        {
                            try
                            {
                                throw new PackageNotFoundException(true, ExceptionMessages.General.PackWIDNotFound(arg));
                            }
                            catch (Exception ex)
                            {
                                Logger.WriteErrorLog(UninstallerMessages.Error.PACKAGE_UID_NOT_FOUND + arg + ".", _namespace, ex, BasicDebugLogger.DebugErrorType.Error);
                                throw;
                            }
                        }
                        string installedDir = null;
                        try
                        {
                            installedDir = Path.GetDirectoryName(arg);
                        }
                        catch (Exception ex)
                        {
                            Logger.WriteErrorLog(UninstallerMessages.Error.INVALID_XML_PATH + arg + ".", _namespace, ex, BasicDebugLogger.DebugErrorType.Error);
                            throw;
                        }
                        result = ProcDelNonReadXMLPackage(arg, installedDir, null, null, _namespace, out outLog, procEvents, argType);
                    }
                }
                else
                {
                    if (argType == UninstallArgType.UID)
                    {
                        try
                        {
                            throw new PackageNotFoundException(true, ExceptionMessages.General.PackWIDNotFound(arg));
                        }
                        catch (Exception ex)
                        {
                            Logger.WriteErrorLog(UninstallerMessages.Error.PACKAGE_UID_NOT_FOUND + arg + ".", _namespace, ex, BasicDebugLogger.DebugErrorType.Error);
                            throw;
                        }
                    }
                    string installedDir = null;
                    try
                    {
                        installedDir = Path.GetDirectoryName(arg);
                    }
                    catch (Exception ex)
                    {
                        Logger.WriteErrorLog(UninstallerMessages.Error.INVALID_XML_PATH + arg + ".", _namespace, ex, BasicDebugLogger.DebugErrorType.Error);
                        throw;
                    }
                    result = ProcDelNonReadXMLPackage(arg, installedDir, null, null, _namespace, out outLog, procEvents, argType);
                }
                outLog = null;

                try
                {
                    if (renumberParts && result == UninstallResult.genPartsRemoved)
                    {
                        GeneratorPartsManager.RenumberParts(_namespace, out outLog, true);
                    }
                }
                catch (Exception ex)
                {
                    Logger.WriteErrorLog(UninstallerMessages.Error.GEN_PART_RENUMBER_FAILED, _namespace, ex, BasicDebugLogger.DebugErrorType.CriticalError);
                    throw;
                }
                log.AppendLogs(outLog);
                Logger.WriteInformationLog(UninstallerMessages.Information.UNINSTALL_PACKAGE_DONE_G, _namespace);
            }
コード例 #5
0
            // -------- Global Packages -------- //
            public static InstalledPackage InstallGlobalPackage(string packagePath, string _namespace, out LogDataList log, bool ignoreClash = false, bool alreadyCopiedToTemp = false, bool procEvents = true, bool skipFileExistenceCheck = false)
            {
                Logger.WriteInformationLog(InstallerMessages.Information.PACKAGE_INSTALL_START_G + packagePath + ".", _namespace);
                log = new LogDataList();
                string      oldPackagePath = packagePath;
                LogDataList outLog         = null;

                try
                {
                    if (!alreadyCopiedToTemp)
                    {
                        packagePath = packagePath = InitPackageInstaller(packagePath, true, _namespace, out outLog);
                    }
                }
                catch (Exception ex)
                {
                    Logger.WriteErrorLog(InstallerMessages.Error.INIT_ERROR + packagePath + ".", _namespace, ex, BasicDebugLogger.DebugErrorType.Error);
                    if (procEvents)
                    {
                        CleanupTempInstallDir(_namespace, false);
                    }
                    throw;
                }
                log.AppendLogs(outLog);

                RMPackage package = null;

                try
                {
                    package = new RMPackage(packagePath, _namespace, out outLog);
                }
                catch (Exception ex)
                {
                    log.AppendLogs(outLog);
                    Logger.WriteErrorLog(InstallerMessages.Error.XML_READ_ERROR + packagePath + ".", _namespace, ex, BasicDebugLogger.DebugErrorType.Error);
                    if (procEvents)
                    {
                        CleanupTempInstallDir(_namespace, false);
                    }
                    throw;
                }
                log.AppendLogs(outLog);

                if (!skipFileExistenceCheck)
                {
                    PerformPackageFilesExistenceCheck(package, _namespace, out outLog);
                    log.AppendLogs(outLog);
                }

                if (!ignoreClash && GlobalPackages.FindByUID(package.UniqueID) != null)
                {
                    try
                    {
                        throw new PackageAlreadyExistsException(ExceptionMessages.General.PackWIDExists(package.UniqueID));
                    }
                    catch (Exception ex)
                    {
                        Logger.WriteErrorLog(InstallerMessages.Error.PACKAGE_ALREADY_EXISTS, _namespace, ex, BasicDebugLogger.DebugErrorType.Error);
                        if (procEvents)
                        {
                            CleanupTempInstallDir(_namespace, false);
                        }
                        throw;
                    }
                }

                if (procEvents && OnPackageInstallBegin != null)
                {
                    OnPackageInstallBegin.Invoke(package, true, oldPackagePath, null);
                }

                try
                {
                    PerformInstallGlobal(package, _namespace);
                }
                catch (Exception ex)
                {
                    Logger.WriteErrorLog(InstallerMessages.Error.INSTALL_PACK_FAILED, _namespace, ex, BasicDebugLogger.DebugErrorType.Error);
                    if (procEvents)
                    {
                        CleanupTempInstallDir(_namespace, false);
                    }
                    throw;
                }

                InstalledPackage newInstall = null;

                try
                {
                    newInstall = CreateGlobalInstalledFile(package, Path.GetDirectoryName(packagePath), _namespace, out outLog);
                    GlobalPackages.AddSafely(newInstall);
                }
                catch
                {
                    if (procEvents)
                    {
                        CleanupTempInstallDir(_namespace, false);
                    }
                    throw;
                }
                log.AppendLogs(outLog);

                if (!alreadyCopiedToTemp)
                {
                    CleanupTempInstallDir(_namespace, false);
                }

                if (OnPackageInstalled != null)
                {
                    OnPackageInstalled.Invoke(package, true, oldPackagePath, null);
                }
                Logger.WriteInformationLog(InstallerMessages.Information.PACKAGE_INSTALL_DONE_G, _namespace);
                return(newInstall);
            }
コード例 #6
0
            public static InstalledPackage UpdateGlobalPackage(string pathToInstaller, string _namespace, out LogDataList log, bool alreadyCopiedToTemp = false, bool skipInstallFileExistenceCheck = false)
            {
                log = new LogDataList();
                Logger.WriteInformationLog(LoggerMessages.PackageManagement.Updater.Information.UPDATE_PACKAGE_START_G + pathToInstaller + ".", _namespace);
                string      origPath = pathToInstaller;
                LogDataList outLog   = null;

                try
                {
                    if (!alreadyCopiedToTemp)
                    {
                        pathToInstaller = Installer.InitPackageInstaller(pathToInstaller, true, _namespace, out outLog);
                    }
                }
                catch (Exception ex)
                {
                    Logger.WriteErrorLog(LoggerMessages.PackageManagement.Updater.Error.UNABLE_EXTRACT_GLOBAL + pathToInstaller + ".", _namespace, ex, BasicDebugLogger.DebugErrorType.Error);
                    throw;
                }
                log.AppendLogs(outLog);

                RMPackage package = null;

                try
                {
                    package = new RMPackage(pathToInstaller, _namespace, out outLog);
                }
                catch (Exception ex)
                {
                    log.AppendLogs(outLog);
                    Logger.WriteErrorLog(LoggerMessages.PackageManagement.Updater.Error.XML_INVALID + pathToInstaller + ".", _namespace, ex, BasicDebugLogger.DebugErrorType.Error);
                    throw;
                }
                log.AppendLogs(outLog);

                if (GlobalPackages == null)
                {
                    try
                    {
                        throw new NullGlobalPackagesException();
                    }
                    catch (Exception ex)
                    {
                        Logger.WriteErrorLog(LoggerMessages.PackageManagement.Updater.Error.NO_GLOBAL_PACKAGES, _namespace, ex, BasicDebugLogger.DebugErrorType.Error);
                        throw;
                    }
                }

                InstalledPackage packageInstalled = GlobalPackages.FindByUID(package.UniqueID);

                if (packageInstalled == null)
                {
                    try
                    {
                        throw new PackageNotFoundException(true);
                    }
                    catch (Exception ex)
                    {
                        Logger.WriteWarningLog(LoggerMessages.PackageManagement.Updater.Warning.PACKAGE_TO_BE_UPDATED_NOT_FOUND, _namespace, ex);
                        throw;
                    }
                }



                if (OnPackageUpdateBegin != null)
                {
                    OnPackageUpdateBegin.Invoke(packageInstalled, package, true, origPath, null);
                }


                try
                {
                    Uninstaller.UninstallGlobalPackage(package.UniqueID, _namespace, out outLog, renumberParts: false, procEvents: false);
                }
                catch (Exception ex)
                {
                    Logger.WriteErrorLog(LoggerMessages.PackageManagement.Updater.Error.FAILED_UNINSTALL, _namespace, ex, BasicDebugLogger.DebugErrorType.CriticalError);
                    throw;
                }
                log.AppendLogs(outLog);

                InstalledPackage newlyInstalledPackage = null;

                try
                {
                    newlyInstalledPackage = Installer.InstallGlobalPackage(pathToInstaller, _namespace, out outLog, true, true, false, skipInstallFileExistenceCheck);
                }
                catch (Exception ex)
                {
                    Logger.WriteErrorLog(LoggerMessages.PackageManagement.Updater.Error.FAILED_INSTALL, _namespace, ex, BasicDebugLogger.DebugErrorType.CriticalError);
                    throw;
                }
                log.AppendLogs(outLog);


                if (OnPackageUpdateDone != null)
                {
                    OnPackageUpdateDone.Invoke(newlyInstalledPackage, newlyInstalledPackage.Package, true, origPath, null);
                }

                Logger.WriteInformationLog(LoggerMessages.PackageManagement.Updater.Information.UPDATE_PACKAGE_DONE_G, _namespace);
                return(newlyInstalledPackage);
            }