Ejemplo n.º 1
0
        void StartInjectToolStripMenuItemClick(object sender, EventArgs e)
        {
            var dgv = this.ActiveControl as DataGridView;

            if (dgv == null)
            {
                return;
            }
            int        index = (dgv.SelectedCells[0].OwningRow.Index);
            EveAccount eA    = Cache.Instance.EveAccountSerializeableSortableBindingList.List[index];

            eA.StartEveInject();
            return;
        }
Ejemplo n.º 2
0
        private void EveManagerThread()
        {
            lock (thisLock){
                while (true)
                {
                    #region every 24 hours
                    if (Cache.Instance.EveSettings.Last24HourTS.AddHours(24) < DateTime.UtcNow)
                    {
                        Cache.Instance.EveSettings.Last24HourTS = DateTime.UtcNow;
                        // empty for now
                    }
                    #endregion

                    #region every hour
                    if (Cache.Instance.EveSettings.LastHourTS.AddHours(1) < DateTime.UtcNow)
                    {
                        Cache.Instance.EveSettings.LastHourTS = DateTime.UtcNow;

                        foreach (EveAccount eA in Cache.Instance.EveAccountSerializeableSortableBindingList.List)
                        {
                            if (eA.EndTime < DateTime.UtcNow && eA.StartTime.AddHours(20) < DateTime.UtcNow)
                            {
                                Cache.Instance.Log("[EveManagerThread] Generating new START/END for [" + eA.AccountName + "]");
                                eA.StartsPast24H = 0;
                                eA.GenerateNewBeginEnd();
                            }
                        }
                    }
                    #endregion

                    for (int i = 0; i < Cache.Instance.EveAccountSerializeableSortableBindingList.List.Count; i++)
                    {
                        EveAccount eA = Cache.Instance.EveAccountSerializeableSortableBindingList.List[i];

                        if (EveServerStatus.Instance.IsEveServerOnline)
                        {
                            if (eA.EveProcessExists())
                            {
                                Process p = Process.GetProcessById(eA.Pid);
                                if (((p.PrivateMemorySize64 / 1024) / 1000) > 1500)
                                {
                                    Cache.Instance.Log("[EveManagerThread] Private working set is too big (> 1500), quitting this instance " + eA.AccountName + " Memorysize " + ((p.PrivateMemorySize64 / 1024) / 1000).ToString());
                                    eA.KillEveProcess();
                                }

                                if (!eA.IsProcessAlive())
                                {
                                    Cache.Instance.Log("[EveManagerThread] Killing process because it's not responding anymore. Accountname: " + eA.AccountName);
                                    eA.KillEveProcess();
                                }
                            }

                            if (!eA.EveProcessExists() && eA.StartsPast24H <= 20 && eA.ShouldBeRunning && DateTime.UtcNow >= nextEveStart)
                            {
                                if (eA.IsActive)
                                {
                                    Cache.Instance.Log("[EveManagerThread] Starting new Eve Instance - AccountName: " + eA.AccountName);
                                    nextEveStart = DateTime.UtcNow.AddSeconds(rnd.Next(25, 35));
                                    eA.StartEveInject();
                                }
                            }

                            if (!eA.ShouldBeRunning && eA.EveProcessExists())
                            {
                                Cache.Instance.Log("[EveManagerThread] Stopping Eve Instance - AccountName: " + eA.AccountName);
                                eA.KillEveProcess();
                            }
                        }
                        else
                        {
                            eA.KillEveProcess();
                        }
                    }



                    Thread.Sleep(5000);
                }
            }
        }