Пример #1
0
        private string ResolveUri(string baseUri)
        {
            string text = baseUri;

            try
            {
                for (int i = 0; i < 5; i++)
                {
                    if (this.helpUpdater.Cmdlet.Abort)
                    {
                        return(text);
                    }
                    string         text2          = text;
                    HttpWebRequest httpWebRequest = (HttpWebRequest)WebRequest.Create(text2);
                    httpWebRequest.AllowAutoRedirect = false;
                    httpWebRequest.Timeout           = 30000;
                    HttpWebResponse     httpWebResponse = (HttpWebResponse)httpWebRequest.GetResponse();
                    WebHeaderCollection headers         = httpWebResponse.Headers;
                    try
                    {
                        if (httpWebResponse.StatusCode == HttpStatusCode.Found || httpWebResponse.StatusCode == HttpStatusCode.Found || httpWebResponse.StatusCode == HttpStatusCode.MovedPermanently || httpWebResponse.StatusCode == HttpStatusCode.MovedPermanently)
                        {
                            Uri uri = new Uri(headers["Location"], UriKind.RelativeOrAbsolute);
                            if (uri.IsAbsoluteUri)
                            {
                                text = uri.ToString();
                            }
                            else
                            {
                                text = text.Replace(httpWebRequest.Address.AbsolutePath, uri.ToString());
                            }
                            text = text.Trim();
                            this.helpUpdater.Cmdlet.WriteVerbose(UpdatableHelpStrings.UpdateRedirectingToHost(text2, text));
                        }
                        else if (httpWebResponse.StatusCode == HttpStatusCode.OK)
                        {
                            return(text);
                        }
                    }
                    finally
                    {
                        httpWebResponse.Close();
                    }
                }
            }
            catch (UriFormatException ex)
            {
                throw new UpdatableExchangeHelpSystemException(UpdatableHelpStrings.UpdateInvalidHelpInfoUriErrorID, new LocalizedString(ex.Message), ErrorCategory.InvalidData, null, ex);
            }
            throw new UpdatableExchangeHelpSystemException(UpdatableHelpStrings.UpdateTooManyUriRedirectionsErrorID, UpdatableHelpStrings.UpdateTooManyUriRedirections(5), ErrorCategory.InvalidOperation, null, null);
        }
Пример #2
0
        internal UpdatableExchangeHelpProgressEventArgs(UpdatePhase phase, LocalizedString subTask, int numerator, int denominator)
        {
            LocalizedString value = LocalizedString.Empty;

            switch (phase)
            {
            case UpdatePhase.Checking:
                value = UpdatableHelpStrings.UpdatePhaseChecking;
                break;

            case UpdatePhase.Downloading:
                value = UpdatableHelpStrings.UpdatePhaseDownloading;
                break;

            case UpdatePhase.Extracting:
                value = UpdatableHelpStrings.UpdatePhaseExtracting;
                break;

            case UpdatePhase.Validating:
                value = UpdatableHelpStrings.UpdatePhaseValidating;
                break;

            case UpdatePhase.Installing:
                value = UpdatableHelpStrings.UpdatePhaseInstalling;
                break;

            case UpdatePhase.Finalizing:
                value = UpdatableHelpStrings.UpdatePhaseFinalizing;
                break;

            case UpdatePhase.Rollback:
                value = UpdatableHelpStrings.UpdatePhaseRollback;
                break;
            }
            this.ProgressStatus = ((!subTask.Equals(LocalizedString.Empty)) ? UpdatableHelpStrings.UpdateStatus2(value, subTask) : UpdatableHelpStrings.UpdateStatus1(value));
            this.Activity       = UpdatableHelpStrings.UpdateModuleName;
            if (denominator != 0)
            {
                this.PercentCompleted = Math.Abs(numerator) * 100 / Math.Abs(denominator);
                return;
            }
            this.PercentCompleted = 0;
        }
Пример #3
0
        private void AsyncDownloadFile(string description, string downloadUrl, string localFilePath, int timeoutMilliseconds, DownloadProgressChangedEventHandler progressHandler, AsyncCompletedEventHandler completionHandler)
        {
            LocalizedString value = UpdatableHelpStrings.UpdateDownloadComplete;

            using (WebClient webClient = new WebClient())
            {
                AutoResetEvent autoResetEvent = new AutoResetEvent(false);
                webClient.DownloadProgressChanged += progressHandler;
                webClient.DownloadFileCompleted   += completionHandler;
                this.downloadException             = null;
                webClient.DownloadFileAsync(new Uri(downloadUrl), localFilePath, autoResetEvent);
                DateTime utcNow = DateTime.UtcNow;
                int      num    = 0;
                while (!this.helpUpdater.Cmdlet.Abort && num <= timeoutMilliseconds)
                {
                    num += 100;
                    if (autoResetEvent.WaitOne(100))
                    {
IL_78:
                        if (num > timeoutMilliseconds)
                        {
                            value = UpdatableHelpStrings.UpdateDownloadTimeout;
                        }
                        TimeSpan timeSpan    = DateTime.UtcNow - utcNow;
                        string   elapsedTime = string.Format("{0}.{1} seconds", timeSpan.TotalSeconds, timeSpan.TotalMilliseconds.ToString().PadLeft(3, '0'));
                        this.helpUpdater.Cmdlet.WriteVerbose(UpdatableHelpStrings.UpdateDownloadTimeElapsed(description, value, elapsedTime));
                        goto IL_EB;
                    }
                }
                value = UpdatableHelpStrings.UpdateDownloadCancelled;
                webClient.CancelAsync();
                goto IL_78;
            }
IL_EB:
            if (this.downloadException != null)
            {
                throw this.downloadException;
            }
        }
Пример #4
0
        internal UpdatableHelpVersionRange ParseManifestForApplicableUpdates(string xml, UpdatableHelpVersion currentVersion, int currentRevision)
        {
            UpdatableHelpVersionRange result = null;
            XmlDocument xmlDocument          = null;

            try
            {
                xmlDocument = this.CreateValidXmlDocument(xml, new ValidationEventHandler(this.ManifestValidationHandler), true);
            }
            catch (XmlException innerException)
            {
                throw new UpdatableExchangeHelpSystemException(UpdatableHelpStrings.UpdateManifestXmlValidationFailureErrorID, UpdatableHelpStrings.UpdateManifestXmlValidationFailure, ErrorCategory.InvalidData, null, innerException);
            }
            new SortedList <int, UpdatableHelpVersion>();
            XmlNodeList childNodes = xmlDocument["ExchangeHelpInfo"]["HelpVersions"].ChildNodes;

            foreach (object obj in childNodes)
            {
                XmlNode xmlNode = (XmlNode)obj;
                if (xmlNode.HasChildNodes)
                {
                    List <string> list       = new List <string>();
                    string        text       = string.Empty;
                    string        cabinetUrl = string.Empty;
                    int           num        = 0;
                    foreach (object obj2 in xmlNode.ChildNodes)
                    {
                        XmlNode xmlNode2 = (XmlNode)obj2;
                        string  name;
                        if ((name = xmlNode2.Name) != null)
                        {
                            if (!(name == "Version"))
                            {
                                if (!(name == "Revision"))
                                {
                                    if (!(name == "CulturesUpdated"))
                                    {
                                        if (name == "CabinetUrl")
                                        {
                                            cabinetUrl = xmlNode["CabinetUrl"].InnerText;
                                        }
                                    }
                                    else
                                    {
                                        text = xmlNode2.InnerText;
                                    }
                                }
                                else if (!int.TryParse(xmlNode2.InnerText, out num))
                                {
                                    throw new UpdatableExchangeHelpSystemException(UpdatableHelpStrings.UpdateInvalidVersionNumberErrorID, UpdatableHelpStrings.UpdateInvalidVersionNumber(xmlNode2.InnerText), ErrorCategory.InvalidData, null, null);
                                }
                            }
                            else
                            {
                                list.Add(xmlNode2.InnerText.Trim());
                            }
                        }
                    }
                    int newestRevisionFound = currentRevision;
                    if (list.Count > 0 && num > 0 && !string.IsNullOrEmpty(text) && !string.IsNullOrEmpty("CabinetUrl"))
                    {
                        foreach (string versionRange in list)
                        {
                            UpdatableHelpVersionRange updatableHelpVersionRange = new UpdatableHelpVersionRange(versionRange, num, text, cabinetUrl);
                            if (updatableHelpVersionRange.IsInRangeAndNewerThan(currentVersion, newestRevisionFound))
                            {
                                result = updatableHelpVersionRange;
                                newestRevisionFound = updatableHelpVersionRange.HelpRevision;
                            }
                        }
                    }
                }
            }
            return(result);
        }
Пример #5
0
        internal Dictionary <string, LocalizedString> ValidateFiles()
        {
            Dictionary <string, LocalizedString> dictionary = new Dictionary <string, LocalizedString>();
            string text = this.LoadFileAsString(this.helpUpdater.PowerShellPsmamlSchemaFilePath);

            if (!string.IsNullOrEmpty(text))
            {
                HelpSchema helpSchema = new HelpSchema("http://schemas.microsoft.com/maml/2004/10", text);
                string     localCabinetExtractionTargetPath = this.helpUpdater.LocalCabinetExtractionTargetPath;
                string     text2 = null;
                int        num   = 0;
                foreach (KeyValuePair <string, List <string> > keyValuePair in this.cabinetFiles)
                {
                    if (this.helpUpdater.Cmdlet.Abort)
                    {
                        return(null);
                    }
                    if (!keyValuePair.Key.Equals(text2))
                    {
                        text2 = keyValuePair.Key;
                    }
                    foreach (string text3 in keyValuePair.Value)
                    {
                        if (this.helpUpdater.Cmdlet.Abort)
                        {
                            return(null);
                        }
                        this.helpUpdater.UpdateProgress(UpdatePhase.Validating, new LocalizedString(text3), ++num, this.filesAffected);
                        string text4 = Path.GetExtension(text3).ToLower();
                        string text5 = text2 + text3;
                        string path  = localCabinetExtractionTargetPath + text5;
                        if (File.Exists(path))
                        {
                            if (text4.Equals(".xml"))
                            {
                                string      s           = this.LoadFileAsString(path);
                                XmlReader   reader      = XmlReader.Create(new StringReader(s));
                                XmlDocument xmlDocument = new XmlDocument();
                                XmlNode     xmlNode     = null;
                                xmlDocument.Load(reader);
                                if (xmlDocument.HasChildNodes)
                                {
                                    bool flag = false;
                                    foreach (object obj in xmlDocument.ChildNodes)
                                    {
                                        XmlNode xmlNode2 = (XmlNode)obj;
                                        if (xmlNode2.LocalName.Equals("helpitems", StringComparison.InvariantCultureIgnoreCase))
                                        {
                                            if (xmlNode != null)
                                            {
                                                flag = true;
                                                break;
                                            }
                                            xmlNode = xmlNode2;
                                        }
                                    }
                                    if (flag)
                                    {
                                        dictionary.Add(text5, UpdatableHelpStrings.UpdateMultipleHelpItems);
                                        continue;
                                    }
                                }
                                if (xmlNode != null)
                                {
                                    for (int i = 0; i < xmlNode.ChildNodes.Count; i++)
                                    {
                                        XmlNode xmlNode3 = xmlNode.ChildNodes[i];
                                        if (xmlNode3.NodeType == XmlNodeType.Element && !xmlNode3.LocalName.StartsWith("_"))
                                        {
                                            if (!xmlNode3.LocalName.Equals("providerHelp", StringComparison.OrdinalIgnoreCase))
                                            {
                                                if (xmlNode3.LocalName.Equals("para", StringComparison.OrdinalIgnoreCase))
                                                {
                                                    if (!xmlNode3.NamespaceURI.Equals("http://schemas.microsoft.com/maml/2004/10", StringComparison.OrdinalIgnoreCase))
                                                    {
                                                        dictionary.Add(text5, UpdatableHelpStrings.UpdateInvalidXmlNamespace("http://schemas.microsoft.com/maml/2004/10"));
                                                        break;
                                                    }
                                                    goto IL_2DD;
                                                }
                                                else if (!xmlNode3.NamespaceURI.Equals("http://schemas.microsoft.com/maml/dev/command/2004/10", StringComparison.OrdinalIgnoreCase))
                                                {
                                                    dictionary.Add(text5, UpdatableHelpStrings.UpdateInvalidXmlNamespace("http://schemas.microsoft.com/maml/2004/10"));
                                                    break;
                                                }
                                            }
                                            if (this.helpUpdater.Cmdlet.Abort)
                                            {
                                                return(null);
                                            }
                                            try
                                            {
                                                helpSchema.CreateValidXmlDocument(xmlNode3.OuterXml, new ValidationEventHandler(this.ContentValidationHandler), false);
                                            }
                                            catch
                                            {
                                                dictionary.Add(text5, UpdatableHelpStrings.UpdateInvalidXml);
                                            }
                                        }
                                        IL_2DD :;
                                    }
                                }
                                else
                                {
                                    dictionary.Add(text5, UpdatableHelpStrings.UpdateInvalidXmlRoot);
                                }
                            }
                            else
                            {
                                if (text4.Equals(".txt"))
                                {
                                    FileStream fileStream = new FileStream(path, FileMode.Open, FileAccess.Read);
                                    try
                                    {
                                        if (fileStream.Length > 2L)
                                        {
                                            byte[] array = new byte[2];
                                            fileStream.Read(array, 0, 2);
                                            if (array[0] == 77 && array[1] == 90)
                                            {
                                                dictionary.Add(text5, UpdatableHelpStrings.UpdateInvalidTextCharacters);
                                            }
                                        }
                                        continue;
                                    }
                                    finally
                                    {
                                        fileStream.Close();
                                    }
                                }
                                dictionary.Add(text5, UpdatableHelpStrings.UpdateUnsupportedFileType);
                            }
                        }
                        else
                        {
                            dictionary.Add(text2 + text3, UpdatableHelpStrings.UpdateFileNotFound);
                        }
                    }
                }
                return(dictionary);
            }
            return(dictionary);
        }
Пример #6
0
 internal UpdatableHelpVersion(string version)
 {
     this.NormalizedVersionNumber = string.Empty;
     this.ElementIntValues        = new int[4];
     string[] array  = new string[4];
     string[] array2 = version.Split(new char[]
     {
         '.'
     });
     if (array2.Length == 4)
     {
         for (int i = 0; i < 4; i++)
         {
             string s = array2[i];
             if (!int.TryParse(s, out this.ElementIntValues[i]) || this.ElementIntValues[i] >= UpdatableHelpVersion.ElementUpperBound[i])
             {
                 throw new UpdatableExchangeHelpSystemException(UpdatableHelpStrings.UpdateInvalidVersionNumberErrorID, UpdatableHelpStrings.UpdateInvalidVersionNumber(new LocalizedString(version)), ErrorCategory.InvalidData, null, null);
             }
             array[i] = this.ElementIntValues[i].ToString().PadLeft(UpdatableHelpVersion.ElementDigits[i], '0');
         }
         this.NormalizedVersionNumber = string.Join(".", array);
         return;
     }
     throw new UpdatableExchangeHelpSystemException(UpdatableHelpStrings.UpdateInvalidVersionNumberErrorID, UpdatableHelpStrings.UpdateInvalidVersionNumber(new LocalizedString(version)), ErrorCategory.InvalidData, null, null);
 }
Пример #7
0
 public LocDescriptionAttribute(UpdatableHelpStrings.IDs ids) : base(UpdatableHelpStrings.GetLocalizedString(ids))
 {
 }
Пример #8
0
        internal UpdatableHelpVersionRange(string versionRange, int revision, string culturesUpdated, string cabinetUrl)
        {
            string[] array = versionRange.Split(new char[]
            {
                '-'
            });
            if (array == null || array.Length < 1 || array.Length > 2)
            {
                throw new UpdatableExchangeHelpSystemException(UpdatableHelpStrings.UpdateInvalidVersionNumberErrorID, UpdatableHelpStrings.UpdateInvalidVersionNumber(new LocalizedString(versionRange)), ErrorCategory.InvalidData, null, null);
            }
            this.StartVersion = new UpdatableHelpVersion(array[0].Trim());
            this.EndVersion   = ((array.Length == 2) ? new UpdatableHelpVersion(array[1].Trim()) : this.StartVersion);
            if (this.CompareVersions(this.StartVersion, this.EndVersion) > 0)
            {
                UpdatableHelpVersion startVersion = this.StartVersion;
                this.StartVersion = this.EndVersion;
                this.EndVersion   = startVersion;
            }
            this.HelpRevision = revision;
            this.CabinetUrl   = cabinetUrl;
            string[] array2 = culturesUpdated.Split(new char[]
            {
                ','
            }, StringSplitOptions.RemoveEmptyEntries);
            List <string> list = new List <string>();

            if (array2 != null)
            {
                foreach (string text in array2)
                {
                    list.Add(text.Trim().ToLower());
                }
            }
            this.CulturesAffected = list.ToArray();
        }
Пример #9
0
        internal UpdatableExchangeHelpSystemException UpdateHelp()
        {
            double num = 90.0;
            UpdatableExchangeHelpSystemException result = null;

            this.ProgressNumerator = 0.0;
            if (!this.Cmdlet.Force)
            {
                if (!this.DownloadThrottleExpired())
                {
                    this.Cmdlet.WriteVerbose(UpdatableHelpStrings.UpdateUseForceToUpdateHelp(this.ThrottlingPeriodHours));
                    return(result);
                }
            }
            try
            {
                this.UpdateProgress(UpdatePhase.Checking, LocalizedString.Empty, (int)this.ProgressNumerator, 100);
                string path = this.LocalTempBase + "UpdateHelp.$$$\\";
                this.CleanDirectory(path);
                this.EnsureDirectory(path);
                HelpDownloader helpDownloader = new HelpDownloader(this);
                helpDownloader.DownloadManifest();
                if (!this.Cmdlet.Abort)
                {
                    UpdatableHelpVersionRange updatableHelpVersionRange = helpDownloader.SearchManifestForApplicableUpdates(this.CurrentHelpVersion, this.CurrentHelpRevision);
                    if (updatableHelpVersionRange != null)
                    {
                        double num2 = 20.0;
                        this.ProgressNumerator = 10.0;
                        this.UpdateProgress(UpdatePhase.Downloading, LocalizedString.Empty, (int)this.ProgressNumerator, 100);
                        string[] array = this.EnumerateAffectedCultures(updatableHelpVersionRange.CulturesAffected);
                        if (array.Length > 0)
                        {
                            this.Cmdlet.WriteVerbose(UpdatableHelpStrings.UpdateApplyingRevision(updatableHelpVersionRange.HelpRevision, string.Join(", ", array)));
                            helpDownloader.DownloadPackage(updatableHelpVersionRange.CabinetUrl);
                            if (this.Cmdlet.Abort)
                            {
                                return(result);
                            }
                            this.ProgressNumerator += num2;
                            this.UpdateProgress(UpdatePhase.Extracting, LocalizedString.Empty, (int)this.ProgressNumerator, 100);
                            HelpInstaller helpInstaller = new HelpInstaller(this, array, num);
                            helpInstaller.ExtractToTemp();
                            if (this.Cmdlet.Abort)
                            {
                                return(result);
                            }
                            this.ProgressNumerator += num2;
                            this.UpdateProgress(UpdatePhase.Validating, LocalizedString.Empty, (int)this.ProgressNumerator, 100);
                            Dictionary <string, LocalizedString> dictionary = helpInstaller.ValidateFiles();
                            if (this.Cmdlet.Abort)
                            {
                                return(result);
                            }
                            if (dictionary != null && dictionary.Count > 0)
                            {
                                this.Cmdlet.WriteVerbose(UpdatableHelpStrings.UpdateInvalidHelpFiles);
                                foreach (KeyValuePair <string, LocalizedString> keyValuePair in dictionary)
                                {
                                    this.Cmdlet.WriteVerbose(UpdatableHelpStrings.UpdateInvalidFileDescription(keyValuePair.Key, keyValuePair.Value));
                                }
                                throw new UpdatableExchangeHelpSystemException(UpdatableHelpStrings.UpdateContentXmlValidationFailureErrorID, UpdatableHelpStrings.UpdateContentXmlValidationFailure, ErrorCategory.NotInstalled, null, null);
                            }
                            this.ProgressNumerator += num2;
                            this.UpdateProgress(UpdatePhase.Installing, LocalizedString.Empty, (int)this.ProgressNumerator, 100);
                            if (!helpInstaller.AtomicInstallFiles())
                            {
                                throw new UpdatableExchangeHelpSystemException(UpdatableHelpStrings.UpdateInstallFilesExceptionErrorID, UpdatableHelpStrings.UpdateInstallFilesException, ErrorCategory.NotInstalled, null, null);
                            }
                        }
                        else
                        {
                            this.Cmdlet.WriteVerbose(UpdatableHelpStrings.UpdateSkipRevision(updatableHelpVersionRange.HelpRevision));
                        }
                        this.UpdateCurrentVersionInRegistry(updatableHelpVersionRange.HelpRevision);
                        this.Cmdlet.WriteVerbose(UpdatableHelpStrings.UpdateRevisionApplied(updatableHelpVersionRange.HelpRevision));
                        this.ProgressNumerator += num2;
                    }
                    else
                    {
                        this.Cmdlet.WriteVerbose(UpdatableHelpStrings.UpdateNoApplicableUpdates);
                    }
                    this.ProgressNumerator = num;
                    this.UpdateProgress(UpdatePhase.Finalizing, LocalizedString.Empty, (int)this.ProgressNumerator, 100);
                    try
                    {
                        this.CleanDirectory(path);
                        if (Directory.Exists(path))
                        {
                            Directory.Delete(path);
                        }
                    }
                    catch
                    {
                    }
                    this.UpdateLastSuccessfulCheckTimestamp(DateTime.UtcNow);
                }
            }
            catch (Exception ex)
            {
                if (ex.GetType() == typeof(UpdatableExchangeHelpSystemException))
                {
                    result = (UpdatableExchangeHelpSystemException)ex;
                }
                else
                {
                    result = new UpdatableExchangeHelpSystemException(UpdatableHelpStrings.UpdateInstallFilesExceptionErrorID, UpdatableHelpStrings.UpdateInstallFilesException, ErrorCategory.InvalidOperation, null, ex);
                }
            }
            this.ProgressNumerator = 100.0;
            this.UpdateProgress(UpdatePhase.Finalizing, LocalizedString.Empty, (int)this.ProgressNumerator, 100);
            return(result);
        }
Пример #10
0
        internal void LoadConfiguration()
        {
            using (RegistryKey registryKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\ExchangeServer\\v15\\Setup"))
            {
                this.ModuleBase = null;
                if (registryKey != null)
                {
                    string text = (string)registryKey.GetValue("MsiInstallpath", string.Empty);
                    if (string.IsNullOrEmpty(text))
                    {
                        throw new UpdatableExchangeHelpSystemException(UpdatableHelpStrings.UpdateInstallationNotFoundErrorID, UpdatableHelpStrings.UpdateInstallationNotFound, ErrorCategory.MetadataError, null, null);
                    }
                    this.ModuleBase = text;
                    if (!this.ModuleBase.EndsWith("\\"))
                    {
                        this.ModuleBase += "\\";
                    }
                    this.ModuleBase = text + "bin\\";
                    this.Cmdlet.WriteVerbose(UpdatableHelpStrings.UpdateInstallationFound(this.ModuleBase));
                    int num  = (int)registryKey.GetValue("MsiProductMajor");
                    int num2 = (int)registryKey.GetValue("MsiProductMinor");
                    int num3 = (int)registryKey.GetValue("MsiBuildMajor");
                    int num4 = (int)registryKey.GetValue("MsiBuildMinor");
                    this.ExchangeVersion = string.Format("{0}.{1}.{2}.{3}", new object[]
                    {
                        num,
                        num2,
                        num3,
                        num4
                    });
                    this.CurrentHelpVersion  = new UpdatableHelpVersion(this.ExchangeVersion);
                    this.CurrentHelpRevision = 0;
                }
                this.LocalTempBase = this.ModuleBase;
            }
            this.PowerShellPsmamlSchemaFilePath = null;
            RegistryKey registryKey2 = Registry.LocalMachine.OpenSubKey(string.Format("SOFTWARE\\Microsoft\\PowerShell\\{0}\\PowerShellEngine", 3));

            if (registryKey2 == null)
            {
                registryKey2 = Registry.LocalMachine.OpenSubKey(string.Format("SOFTWARE\\Microsoft\\PowerShell\\{0}\\PowerShellEngine", 1));
            }
            if (registryKey2 != null)
            {
                try
                {
                    string text2 = registryKey2.GetValue("ApplicationBase", null).ToString();
                    if (!string.IsNullOrEmpty(text2))
                    {
                        this.PowerShellPsmamlSchemaFilePath = text2 + "\\Schemas\\PSMaml\\maml.xsd";
                    }
                }
                finally
                {
                    registryKey2.Dispose();
                }
            }
            this.ManifestUrl                       = string.Empty;
            this.ThrottlingPeriodHours             = 24;
            this.LastSuccessfulCheckTimestampValue = new DateTime(1980, 1, 1).ToUniversalTime();
            RegistryKey registryKey3 = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\ExchangeServer\\v15\\UpdateExchangeHelp");

            if (registryKey3 == null)
            {
                registryKey3 = Registry.LocalMachine.CreateSubKey("SOFTWARE\\Microsoft\\ExchangeServer\\v15\\UpdateExchangeHelp");
            }
            if (registryKey3 != null)
            {
                try
                {
                    this.ManifestUrl = registryKey3.GetValue("ManifestUrl", "http://go.microsoft.com/fwlink/p/?LinkId=287244").ToString();
                    if (string.IsNullOrEmpty(this.ManifestUrl))
                    {
                        throw new UpdatableExchangeHelpSystemException(UpdatableHelpStrings.UpdateRegkeyNotFoundErrorID, UpdatableHelpStrings.UpdateRegkeyNotFound("SOFTWARE\\Microsoft\\ExchangeServer\\v15", "\\UpdateExchangeHelp", "ManifestUrl"), ErrorCategory.MetadataError, null, null);
                    }
                    int num5 = (int)registryKey3.GetValue("CurrentHelpRevision", 0);
                    if (num5 > 0)
                    {
                        this.CurrentHelpVersion  = new UpdatableHelpVersion(this.ExchangeVersion);
                        this.CurrentHelpRevision = num5;
                    }
                    int throttlingPeriodHours;
                    if (int.TryParse(registryKey3.GetValue("ThrottlingPeriodHours", this.ThrottlingPeriodHours).ToString(), out throttlingPeriodHours))
                    {
                        this.ThrottlingPeriodHours = throttlingPeriodHours;
                    }
                    DateTime lastSuccessfulCheckTimestampValue;
                    if (DateTime.TryParse(registryKey3.GetValue("LastSuccessfulCheckTimestamp", this.LastSuccessfulCheckTimestampValue.ToString()).ToString(), out lastSuccessfulCheckTimestampValue))
                    {
                        this.LastSuccessfulCheckTimestampValue = lastSuccessfulCheckTimestampValue;
                    }
                    this.Cmdlet.WriteVerbose(UpdatableHelpStrings.UpdateManifestUrl(this.ManifestUrl));
                    this.Cmdlet.WriteVerbose(UpdatableHelpStrings.UpdateCurrentHelpVersion(this.CurrentHelpVersion.NormalizedVersionNumberWithRevision(this.CurrentHelpRevision)));
                    return;
                }
                finally
                {
                    registryKey3.Close();
                    registryKey3.Dispose();
                }
            }
            throw new UpdatableExchangeHelpSystemException(UpdatableHelpStrings.UpdateConfigRegKeyNotFoundErrorID, UpdatableHelpStrings.UpdateConfigRegKeyNotFound("SOFTWARE\\Microsoft\\ExchangeServer\\v15", "\\UpdateExchangeHelp"), ErrorCategory.MetadataError, null, null);
        }