Private GIT

Skip to content
Snippets Groups Projects
Select Git revision
  • dd06d093ae6f76cd9f65522f032cc35517bf9041
  • master default protected
  • gh-pages
  • feature/irc
  • v0.7.237
  • v0.7.235
  • v0.7.232
  • v0.7.228
  • v0.7.219
  • v0.7.217
  • v0.7.211
  • v0.7.200
  • v0.7.197
  • v0.7.195
  • v0.7.184
  • v0.7.181
  • v0.7.177
  • v0.7.174
  • v0.7.172
  • v0.7.168
  • v0.7.164
  • v0.7.146
  • v0.7.142
  • v0.7.138
24 results

UpdateService.cs

Blame
  • UpdateService.cs 10.71 KiB
    using ICSharpCode.SharpZipLib.GZip;
    using ICSharpCode.SharpZipLib.Tar;
    using ICSharpCode.SharpZipLib.Zip;
    using Jackett.Models.GitHub;
    using Jackett.Utils.Clients;
    using Newtonsoft.Json;
    using NLog;
    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.IO;
    using System.Linq;
    using System.Net.Security;
    using System.Reflection;
    using System.Security.Cryptography.X509Certificates;
    using System.Text;
    using System.Threading;
    using System.Threading.Tasks;
    using Jackett.Services.Interfaces;
    using Jacket.Common;
    using Jackett.Models.Config;
    
    namespace Jackett.Services
    {
    
        public class UpdateService: IUpdateService
        {
            Logger logger;
            WebClient client;
            IConfigurationService configService;
            ManualResetEvent locker = new ManualResetEvent(false);
            ITrayLockService lockService;
            bool forceupdatecheck = false;
    
            public UpdateService(Logger l, WebClient c, IConfigurationService cfg, ITrayLockService ls)
            {
                logger = l;
                client = c;
                configService = cfg;
                lockService = ls;
            }
    
            private string ExePath()
            {
                var location = new Uri(Assembly.GetEntryAssembly().GetName().CodeBase);
                return new FileInfo(location.AbsolutePath).FullName;
            }
    
            public void StartUpdateChecker()
            {
                Task.Factory.StartNew(UpdateWorkerThread);
            }
    
            public void CheckForUpdatesNow()
            {
                forceupdatecheck = true;
                locker.Set();
            }
    
            private async void UpdateWorkerThread()
            {
                while (true)
                {
                    locker.WaitOne((int)new TimeSpan(24, 0, 0).TotalMilliseconds);
                    locker.Reset();
                    await CheckForUpdates();
                }
            }
    
            private bool AcceptCert(object sender, X509Certificate certificate, X509Chain chain, SslPolicyErrors sslPolicyErrors)