コード例 #1
0
ファイル: GitHubUpgrader.cs プロジェクト: py361/VFSForGit
        private bool TryRunInstallerForAsset(string assetId, out int installerExitCode, out string error)
        {
            error             = null;
            installerExitCode = 0;

            bool   installerIsRun = false;
            string path;
            string installerArgs;

            if (this.TryGetLocalInstallerPath(assetId, out path, out installerArgs))
            {
                string logFilePath = GVFSEnlistment.GetNewLogFileName(ProductUpgraderInfo.GetLogDirectoryPath(), Path.GetFileNameWithoutExtension(path));
                string args        = installerArgs + " /Log=" + logFilePath;
                this.RunInstaller(path, args, out installerExitCode, out error);

                if (installerExitCode != 0 && string.IsNullOrEmpty(error))
                {
                    error = assetId + " installer failed. Error log: " + logFilePath;
                }

                installerIsRun = true;
            }
            else
            {
                error = "Could not find downloaded installer for " + assetId;
            }

            return(installerIsRun);
        }
コード例 #2
0
        private bool TryRunInstallerForAsset(string assetId, out int installerExitCode, out string error)
        {
            error             = null;
            installerExitCode = 0;

            bool   installerIsRun = false;
            string path;
            string installerArgs;

            if (this.TryGetLocalInstallerPath(assetId, out path, out installerArgs))
            {
                if (!this.dryRun)
                {
                    string logFilePath = GVFSEnlistment.GetNewLogFileName(
                        ProductUpgraderInfo.GetLogDirectoryPath(),
                        Path.GetFileNameWithoutExtension(path),
                        this.UpgradeInstanceId,
                        this.fileSystem);

                    string args     = installerArgs + " /Log=" + logFilePath;
                    string certCN   = null;
                    string issuerCN = null;
                    switch (assetId)
                    {
                    case GVFSAssetId:
                    {
                        certCN   = GVFSSigner;
                        issuerCN = GVFSCertIssuer;
                        break;
                    }

                    case GitAssetId:
                    {
                        certCN   = GitSigner;
                        issuerCN = GitCertIssuer;
                        break;
                    }
                    }

                    this.RunInstaller(path, args, certCN, issuerCN, out installerExitCode, out error);

                    if (installerExitCode != 0 && string.IsNullOrEmpty(error))
                    {
                        error = assetId + " installer failed. Error log: " + logFilePath;
                    }
                }

                installerIsRun = true;
            }
            else
            {
                error = "Could not find downloaded installer for " + assetId;
            }

            return(installerIsRun);
        }