Private GIT

Skip to content
Snippets Groups Projects
Select Git revision
  • 0e9b160d29b634545467f01b18b73f1c57caf829
  • 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

Program.cs

Blame
  • Program.cs 9.19 KiB
    using CommandLine;
    using Jackett.Services;
    using System;
    using System.Collections.Generic;
    using System.Diagnostics;
    using System.IO;
    using System.Linq;
    using System.Reflection;
    using System.Text;
    using System.Threading;
    using System.Threading.Tasks;
    using System.Web;
    /*
    // no supported by appveyor, disabeling for now
    #if __MonoCS__
    using Mono.Unix.Native;
    #endif
    */
    
    namespace Jackett.Updater
    {
        class Program
        {
            static void Main(string[] args)
            {
                new Program().Run(args);
            }
    
            private void Run(string[] args)
            {
                Engine.SetupLogging(null, "updater.txt");
                Engine.Logger.Info("Jackett Updater v" + GetCurrentVersion());
                Engine.Logger.Info("Options \"" + string.Join("\" \"", args) + "\"");
                try {
                    var options = new UpdaterConsoleOptions();
                    if (Parser.Default.ParseArguments(args, options))
                    {
                        ProcessUpdate(options);
                    }
                    else
                    {
                        Engine.Logger.Error("Failed to process update arguments!");
                        Console.ReadKey();
                    }
                }
                catch (Exception e)
                {
                    Engine.Logger.Error(e, "Exception applying update!");
                }
            }
    
            private string GetCurrentVersion()
            {
                var assembly = System.Reflection.Assembly.GetExecutingAssembly();
                var fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
                return fvi.FileVersion;
            }
    
            private void KillPids(int[] pids)
            {
                foreach (var pid in pids)
                {
                    try
                    {
                        var proc = Process.GetProcessById(pid);
                        Engine.Logger.Info("Killing process " + proc.Id);
                        proc.Kill();
                        var exited = proc.WaitForExit(5000);
                        if (!exited)
                            Engine.Logger.Info("Process " + pid.ToString() + " didn't exit within 5 seconds");