protected override void InternalProcessRecord()
        {
            base.InternalProcessRecord();
            Version tenantVersion = null;

            if (this.tenantVersionRequired)
            {
                ExchangeConfigurationUnit dataObject = this.session.Read <ExchangeConfigurationUnit>(base.CurrentOrganizationId.ConfigurationUnit);
                Version installedVersion             = ConfigurationContext.Setup.InstalledVersion;
                TenantOrganizationPresentationObject tenantOrganizationPresentationObject = new TenantOrganizationPresentationObject(dataObject);
                tenantVersion = new Version(installedVersion.Major, installedVersion.Minor, tenantOrganizationPresentationObject.BuildMajor, tenantOrganizationPresentationObject.BuildMinor);
            }
            SupportedVersion supportedVersion = this.toolsData.GetSupportedVersion(this.Identity, tenantVersion);

            base.WriteObject(this.ConstructOutputObject(supportedVersion));
        }
Beispiel #2
0
        private static SupportedVersion GetSupportedVersion(ToolInfoData toolInfo, Version tenantVersion)
        {
            SupportedVersion supportedVersion = null;

            if (tenantVersion != null && toolInfo.customSupportedVersion != null)
            {
                foreach (CustomSupportedVersion customSupportedVersion2 in toolInfo.customSupportedVersion)
                {
                    if (SupportedToolsData.IsInRange(customSupportedVersion2, tenantVersion))
                    {
                        supportedVersion = customSupportedVersion2;
                        break;
                    }
                }
            }
            return(supportedVersion ?? toolInfo.defaultSupportedVersion);
        }
        private ToolInformation ConstructOutputObject(SupportedVersion supportedVersion)
        {
            ToolInformation result;

            try
            {
                Version           version       = SupportedToolsData.GetVersion(supportedVersion.minSupportedVersion, SupportedToolsData.MinimumVersion);
                Version           version2      = SupportedToolsData.GetVersion(supportedVersion.latestVersion, SupportedToolsData.MaximumVersion);
                ToolVersionStatus versionStatus = GetToolInformation.GetVersionStatus(version, version2, this.Version);
                Uri updateInformationUrl        = (versionStatus != ToolVersionStatus.LatestVersion) ? new Uri(supportedVersion.updateUrl) : null;
                result = new ToolInformation(this.Identity, versionStatus, version, version2, updateInformationUrl);
            }
            catch (Exception e)
            {
                this.HandleInvalidSupportedToolsData(e);
                result = null;
            }
            return(result);
        }