示例#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
        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
            });
        }