コード例 #1
0
ファイル: Updater.cs プロジェクト: vaginessa/HostsEditor-3
        /// <summary>
        /// Retrieves the information pertaining to the most recent release of the program from the GitHub repo.
        /// </summary>
        /// <returns>JObject containins output from github releases page</returns>
        private JObject getLatestReleaseInfo()
        {
            LimitableWebClient client = new LimitableWebClient {
                Timeout = 5000
            };                                                                     // WebClient with timeout of 5 seconds

            client.Headers.Add("User-agent", $"HostsEditor {Version} (https://github.com/aerouk/HostsEditor)");

            var json = client.DownloadString("http://api.github.com/repos/aerouk/HostsEditor/releases/latest");

            return(JObject.Parse(json));
        }
コード例 #2
0
        /// <summary>
        /// Retrieves the information pertaining to the most recent release of the program from the GitHub repo.
        /// </summary>
        /// <returns>JObject containins output from github releases page</returns>
        private JObject getLatestReleaseInfo()
        {
            LimitableWebClient client = new LimitableWebClient {
                Timeout = 5000
            };                                                                     // WebClient with timeout of 5 seconds

            ServicePointManager.Expect100Continue = true;
            ServicePointManager.SecurityProtocol  = SecurityProtocolType.Tls12;

            client.Headers.Add("User-agent", $"HostsEditor {Version} (https://github.com/aerouk/HostsEditor)");

            var json = client.DownloadString("https://api.github.com/repos/aerouk/HostsEditor/releases/latest");

            return(JObject.Parse(json));
        }