Пример #1
0
        private void backgroundWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            System.Globalization.CultureInfo ci = new System.Globalization.CultureInfo("en-GB");
            System.Threading.Thread.CurrentThread.CurrentCulture   = ci;
            System.Threading.Thread.CurrentThread.CurrentUICulture = ci;

            Oxigen1Uninstaller uninstaller = new Oxigen1Uninstaller((BackgroundWorker)sender);

            e.Result = uninstaller.Uninstall();
        }
Пример #2
0
        /// <summary>
        /// Silently installs the application.
        /// </summary>
        internal static void Install()
        {
            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 1");

            if (!SetupHelper.HasAdminRights())
            {
                return;
            }

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 2");

            if (SetupHelper.OlderOxigenExists())
            {
                Oxigen1Uninstaller             uninstaller = new Oxigen1Uninstaller();
                OldOxigenUninstallReturnStatus status      = uninstaller.Uninstall();

                if (status.Status != UninstallOlderSoftwareStatus.Success)
                {
                    return;
                }
            }

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 3");

            if (SetupHelper.OxigenExists())
            {
                return;
            }

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 4");

            if (!SetupHelper.PrerequisitesMet())
            {
                return;
            }

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 5");

            if (!File.Exists(Directory.GetCurrentDirectory() + "\\Oxigen.msi"))
            {
                return;
            }

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 6");

            string userGUID = GetUserGUIDByUsername();

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 7");

            if (string.IsNullOrEmpty(userGUID))
            {
                return;
            }

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 8");

            string machineGUID = System.Guid.NewGuid().ToString().ToUpper() + "_" + SetupHelper.GetRandomLetter();

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 9");

            AppDataSingleton.Instance.User.UserGUID    = userGUID;
            AppDataSingleton.Instance.User.MachineGUID = machineGUID;

            // get installation paths
            if (!GetBinaryPath())
            {
                return;
            }

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 10");

            if (!GetDataPath())
            {
                return;
            }

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 11");

            if (!SetupHelper.IsSufficientSpace(AppDataSingleton.Instance.BinariesPath, _binaryRequiredSpace))
            {
                return;
            }

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 12");

            if (!SetupHelper.IsSufficientSpace(AppDataSingleton.Instance.DataPath, _dataRequiredSpace))
            {
                return;
            }

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 13");

            CalculateMaxDiskSpaceForAssets();

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 14");

            if (AppDataSingleton.Instance.FileDetectedChannelSubscriptionsLocal.SubscriptionSet != null)
            {
                AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 14 - 1");
                AppDataSingleton.Instance.ChannelSubscriptionsToUpload.SubscriptionSet = SetupHelper.GetChannelSubscriptionsNetFromLocal(AppDataSingleton.Instance.FileDetectedChannelSubscriptionsLocal.SubscriptionSet);
                AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 14 - 2");
            }

            AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 15");

            try
            {
                AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 16");

                if (!InstallMSI())
                {
                    return;
                }

                AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 17");

                SetupHelper.DoPostMSIInstallSteps();

                AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 18");

                SetupHelper.CopySetup();

                AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 19");

                if (!SendDetails())
                {
                    AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 20");

                    UninstallMSI();

                    AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 21");

                    SetupHelper.RemoveAllFiles(AppDataSingleton.Instance.BinariesPath + "bin", SetupHelper.GetSystemDirectory(), AppDataSingleton.Instance.DataPath);

                    AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 22");

                    return;
                }

                AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 23");

                SetupHelper.SetRegistryForModifyUninstall();

                AppDataSingleton.Instance.SetupLogger.WriteMessage("Silent Install 24");
            }
            catch (Exception ex)
            {
                AppDataSingleton.Instance.SetupLogger.WriteMessage(ex.ToString());

                UninstallMSI();

                SetupHelper.RemoveAllFiles(AppDataSingleton.Instance.BinariesPath + "bin", SetupHelper.GetSystemDirectory(), AppDataSingleton.Instance.DataPath);
                return;
            }

            StartApps();
            SetScreensaver();
        }