Beispiel #1
0
        private bool TryInitializeUpgrader(out string error)
        {
            if (GVFSPlatform.Instance.UnderConstruction.SupportsGVFSUpgrade)
            {
                error = null;
                if (this.upgrader == null)
                {
                    JsonTracer jsonTracer  = new JsonTracer(GVFSConstants.GVFSEtwProviderName, "UpgradeVerb");
                    string     logFilePath = GVFSEnlistment.GetNewGVFSLogFileName(
                        ProductUpgraderInfo.GetLogDirectoryPath(),
                        GVFSConstants.LogFileTypes.UpgradeVerb);
                    jsonTracer.AddLogFileEventListener(logFilePath, EventLevel.Informational, Keywords.Any);

                    this.tracer        = jsonTracer;
                    this.prerunChecker = new InstallerPreRunChecker(this.tracer, this.Confirmed ? GVFSConstants.UpgradeVerbMessages.GVFSUpgradeConfirm : GVFSConstants.UpgradeVerbMessages.GVFSUpgrade);

                    IProductUpgrader upgrader;
                    if (ProductUpgraderFactory.TryCreateUpgrader(out upgrader, this.tracer, out error))
                    {
                        this.upgrader = upgrader;
                    }
                    else
                    {
                        error = $"ERROR: {error}";
                    }
                }

                return(this.upgrader != null);
            }
            else
            {
                error = $"ERROR: {GVFSConstants.UpgradeVerbMessages.GVFSUpgrade} is not supported on this operating system.";
                return(false);
            }
        }
Beispiel #2
0
        private void TimerCallback(object unusedState)
        {
            string errorMessage = null;
            InstallerPreRunChecker prerunChecker = new InstallerPreRunChecker(this.tracer, string.Empty);
            IProductUpgrader       productUpgrader;
            bool deleteExistingDownloads = true;

            if (ProductUpgraderFactory.TryCreateUpgrader(out productUpgrader, this.tracer, out errorMessage))
            {
                if (prerunChecker.TryRunPreUpgradeChecks(out string _) && this.TryDownloadUpgrade(productUpgrader, out errorMessage))
                {
                    deleteExistingDownloads = false;
                }
            }

            if (errorMessage != null)
            {
                this.tracer.RelatedError(errorMessage);
            }

            if (deleteExistingDownloads)
            {
                ProductUpgraderInfo.DeleteAllInstallerDownloads();
            }
        }
Beispiel #3
0
        private bool TryInitialize(out string errorMessage)
        {
            if (this.upgrader == null)
            {
                IProductUpgrader upgrader;
                if (!ProductUpgraderFactory.TryCreateUpgrader(out upgrader, this.tracer, out errorMessage, this.DryRun, this.NoVerify))
                {
                    return(false);
                }

                this.upgrader = upgrader;
            }

            errorMessage = null;
            return(true);
        }