示例#1
0
文件: Installer.cs 项目: zobe123/Ombi
        public void Start(StartupOptions opt)
        {
            // Kill Ombi Process
            var p = new ProcessProvider();

            try
            {
                p.Kill(opt);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            // Make sure the process has been killed
            while (p.FindProcessByName(opt.ProcessName).Any())
            {
                Thread.Sleep(500);
                _log.LogDebug("Found another process called {0}, KILLING!", opt.ProcessName);
                var proc = p.FindProcessByName(opt.ProcessName).FirstOrDefault();
                if (proc != null)
                {
                    _log.LogDebug($"[{proc.Id}] - {proc.Name} - Path: {proc.StartPath}");
                    opt.OmbiProcessId = proc.Id;
                    p.Kill(opt);
                }
            }

            _log.LogDebug("Starting to move the files");
            MoveFiles(opt);
            _log.LogDebug("Files replaced");
            // Start Ombi
            StartOmbi(opt);
        }
示例#2
0
文件: Installer.cs 项目: itzfk0/ombi
        public void Start(StartupOptions opt)
        {
            // Kill Ombi Process
            var  p      = new ProcessProvider();
            bool killed = false;

            try
            {
                killed = p.Kill(opt);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }

            if (!killed)
            {
                _log.LogDebug("Couldn't kill the ombi process");
                return;
            }

            _log.LogDebug("Starting to move the files");
            MoveFiles(opt);
            _log.LogDebug("Files replaced");
            // Start Ombi
            StartOmbi(opt);
        }
示例#3
0
        private static UpdateStartupContext ParseArgs(string[] args)
        {
            var proc     = new ProcessProvider();
            var ombiProc = proc.FindProcessByName("Ombi").FirstOrDefault().Id;

            return(new UpdateStartupContext
            {
                DownloadPath = args[0],
                ProcessId = ombiProc,
                StartupArgs = args.Length > 1 ? args[1] : string.Empty
            });
        }
示例#4
0
 public DetectApplicationType()
 {
     _processProvider = new ProcessProvider();
     _serviceProvider = new ServiceProvider(_processProvider);
 }