Beispiel #1
0
        /// <summary>
        ///     Internal "OnFrame" handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FrameworkOnFrame(object sender, EventArgs e)
        {
            var st = new Stopwatch();
            st.Start();
            using (var pySharp = new PySharp.PySharp(true))
            {
                // Make the link to the instance
                PySharp = pySharp;

            //#if !NO_DIRECTEVE_SECURITY
            //                // Pulse security
            //                if (_security == null || !_security.Pulse())
            //                {
            //                    if (!_securityCheckFailed)
            //                    {
            //                        _securityCheckFailed = true;
            //                        Log("DirectEve supported instance check failed!");
            //                    }
            //                    return;
            //                }

            //                if (_securityCheckFailed)
            //                {
            //                    _securityCheckFailed = false;
            //                    Log("DirectEve supported instance check succeeded, continuing...");
            //                }
            //#endif
                // Get current target list
                dynamic ps = pySharp;
                // targetsByID and targeting are now dictionaries
                List<long> targets = ps.__builtin__.sm.services["target"].targetsByID.keys().ToList<long>();
                targets.AddRange(ps.__builtin__.sm.services["target"].targeting.keys().ToList<long>());

                // Update currently locked targets
                targets.ForEach(t => _lastKnownTargets[t] = DateTime.Now);
                // Remove all targets that have not been locked for 3 seconds
                foreach (var t in _lastKnownTargets.Keys.ToArray())
                {
                    if (DateTime.Now.AddSeconds(-3) < _lastKnownTargets[t])
                        continue;

                    _lastKnownTargets.Remove(t);
                }

                ////Populate the statistic variables
                if (_enableStatisticsModifying)
                {
                    CheckStatistics();
                }

                // Check if we're still valid
                if (OnFrame != null)
                    OnFrame(this, new EventArgs());

                // Clear any cache that we had during this frame
                _localSvcCache.Clear();
                _entitiesById = null;
                _windows = null;
                _modules = null;
                _const = null;
                _bookmarks = null;
                _agentMissions = null;

                _containers.Clear();
                _itemHangar = null;
                _shipHangar = null;
                _shipsCargo = null;
                _shipsOreHold = null;
                _shipsModules = null;
                _shipsDroneBay = null;
                _listGlobalAssets = null;
                _me = null;
                _activeShip = null;
                _standings = null;
                _navigation = null;
                _session = null;
                _login = null;
                _skills = null;

                // Remove the link
                PySharp = null;

                st.Stop();
                _lastOnframeTook = st.ElapsedMilliseconds;
            }
        }
Beispiel #2
0
        /// <summary>
        ///     Internal "OnFrame" handler
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void FrameworkOnFrame(object sender, EventArgs e)
        {
            var st = new Stopwatch();

            st.Start();
            using (var pySharp = new PySharp.PySharp(true))
            {
                // Make the link to the instance
                PySharp = pySharp;

//#if !NO_DIRECTEVE_SECURITY
//                // Pulse security
//                if (_security == null || !_security.Pulse())
//                {
//                    if (!_securityCheckFailed)
//                    {
//                        _securityCheckFailed = true;
//                        Log("DirectEve supported instance check failed!");
//                    }
//                    return;
//                }

//                if (_securityCheckFailed)
//                {
//                    _securityCheckFailed = false;
//                    Log("DirectEve supported instance check succeeded, continuing...");
//                }
//#endif
                // Get current target list
                dynamic ps = pySharp;
                // targetsByID and targeting are now dictionaries
                List <long> targets = ps.__builtin__.sm.services["target"].targetsByID.keys().ToList <long>();
                targets.AddRange(ps.__builtin__.sm.services["target"].targeting.keys().ToList <long>());

                // Update currently locked targets
                targets.ForEach(t => _lastKnownTargets[t] = DateTime.Now);
                // Remove all targets that have not been locked for 3 seconds
                foreach (var t in _lastKnownTargets.Keys.ToArray())
                {
                    if (DateTime.Now.AddSeconds(-3) < _lastKnownTargets[t])
                    {
                        continue;
                    }

                    _lastKnownTargets.Remove(t);
                }

                ////Populate the statistic variables
                if (_enableStatisticsModifying)
                {
                    CheckStatistics();
                }

                // Check if we're still valid
                if (OnFrame != null)
                {
                    OnFrame(this, new EventArgs());
                }

                // Clear any cache that we had during this frame
                _localSvcCache.Clear();
                _entitiesById  = null;
                _windows       = null;
                _modules       = null;
                _const         = null;
                _bookmarks     = null;
                _agentMissions = null;

                _containers.Clear();
                _itemHangar       = null;
                _shipHangar       = null;
                _shipsCargo       = null;
                _shipsOreHold     = null;
                _shipsModules     = null;
                _shipsDroneBay    = null;
                _listGlobalAssets = null;
                _me         = null;
                _activeShip = null;
                _standings  = null;
                _navigation = null;
                _session    = null;
                _login      = null;
                _skills     = null;

                // Remove the link
                PySharp = null;

                st.Stop();
                _lastOnframeTook = st.ElapsedMilliseconds;
            }
        }