/// <summary>
 /// Cleans the settings.
 /// </summary>
 /// <param name="cleanupType">Type of the cleanup.</param>
 /// <param name="path">The path.</param>
 public void CleanSettings(CleanupType cleanupType, string path)
 {
     if (cleanupType == CleanupType.CleanSettings)
     {
         _fileSystemScanner.CleanSettings(path);
     }
     else if (cleanupType == CleanupType.CheckSettings)
     {
         _fileSystemScanner.CheckSettings(path);
     }
 }
Ejemplo n.º 2
0
        public void RunEvaluation(ulong tickCounter, CleanupType type)
        {
            if (InvalidEvaluation(tickCounter))
            {
                return;
            }
            if (!ValidPass())
            {
                return;
            }
            switch (type)
            {
            case CleanupType.Debris:
                if (_gridType != GridType.Debris)
                {
                    break;
                }
                RunDebrisCleanup();
                break;

            case CleanupType.Standard:
                if (_hasPlayerSmallOwner)
                {
                    break;
                }
                RunStandardCleanup();
                break;

            case CleanupType.Aggressive:
                if (_hasPlayerSmallOwner || !UserSettings.UseAggressiveCleanup)
                {
                    break;
                }
                RunAggressiveCleanup();
                break;

            case CleanupType.SuperAggressive:
                if (!_hasPlayerSmallOwner || !UserSettings.UseSuperAggressiveCleanup)
                {
                    break;
                }
                RunSuperAggressiveCleanup();
                break;

            case CleanupType.None:
                break;

            default:
                break;
            }
        }
Ejemplo n.º 3
0
 private void RunDebrisCleanup()
 {
     if (AnyPlayersInRange(UserSettings.DebrisCleanupRange))
     {
         _lastPassInformation.ConsecutiveDebrisHits = 0;
         return;
     }
     _lastPassInformation.ConsecutiveDebrisHits++;
     if (_lastPassInformation.ConsecutiveDebrisHits < UserSettings.PassesBeforeDebrisCleanup)
     {
         return;
     }
     _closeReason = CleanupType.Debris;
     NukeTheSubs();
 }
Ejemplo n.º 4
0
        private void RunSuperAggressiveCleanup()
        {
            int range =
                (_lastPassInformation.PrefabInfo.IsNull ||
                 _lastPassInformation.PrefabInfo.PrefabType == PrefabType.CargoShip)
                                        ? UserSettings.CargoSuperAggressiveCleanupRange
                                        : UserSettings.EncounterSuperAggressiveCleanupRange;

            if (AnyPlayersInRange(range))
            {
                _lastPassInformation.ConsecutiveSuperAggressiveHits = 0;
                return;
            }
            _lastPassInformation.ConsecutiveSuperAggressiveHits++;
            if (_lastPassInformation.ConsecutiveSuperAggressiveHits < UserSettings.PassesBeforeSuperAggressiveCleanup)
            {
                return;
            }
            _closeReason = CleanupType.SuperAggressive;
            NukeTheSubs();
        }
Ejemplo n.º 5
0
        public void Cleanup(CleanupType type)
        {
            // Remove any "stale" connections - i.e. those
            // 1) In state REPORTED, FINISHED or NEW with no traffic for 20 seconds
            // 2) In any other state with no traffic for 5 minutes

            // Also, make FINISHED any connection with > 200 packets outstanding unanalysed
            // (i.e. there has been a "hole" in the traffic :-( )

            // only need to do this for direction 0 - List is just a double index

            //Non_DICOM ongoing connections
            foreach (TCPState state in List[0].Values)
            {
                if(state.PacketCount > 200)
                {
                    if(state.State[0] == TCPState.States.NEW)
                    {
                        EndOfStream(state,0," >200 packets");
                        state.Clear();
                    }
                }
            }

            bool moretodo = true;
            while(moretodo)
            {
                moretodo = false;
                foreach (TCPState state in List[0].Values)
                {
                    //This is based on packet time, not current time
                    TimeSpan ts = LastParsedPacketTime - state.LastAddedTime;
                    string err = "";

                    if(type == CleanupType.TERMINAL)
                        err = "Forced Close";
                    else if( ts.TotalSeconds > 20 && state.State[0] != TCPState.States.RUNNING)
                        err = " > 20 seconds and not running : State was " + state.State.ToString();
            //					else if( ts.TotalSeconds > 300)  // &&&& 300
            //						err = " > 300 seconds since last activity";

                    if(err != "")
                    {
                        List[0].Remove(state.Signature[0]);
                        List[1].Remove(state.Signature[1]);
                        if(running && state.State[0] != TCPState.States.REPORTED)
                        //if((state.State[0] != TCPState.States.REPORTED) && (state.State[0] != TCPState.States.FINISHED))
                        {
                            EndOfStream(state,0,err);
                        }
                        moretodo = true;
                        break;
                    }
                }
            }
        }
Ejemplo n.º 6
0
        public void Cleanup(CleanupType type)
        {
            // Remove any "stale" connections - i.e. those
            // 1) In state REPORTED, FINISHED or NEW with no traffic for 20 seconds
            // 2) In any other state with no traffic for 5 minutes

            // Also, make FINISHED any connection with > 200 packets outstanding unanalysed
            // (i.e. there has been a "hole" in the traffic :-( )

            // only need to do this for direction 0 - List is just a double index

            //Non_DICOM ongoing connections
            foreach (TCPState state in List[0].Values)
            {
                if (state.PacketCount > 200)
                {
                    if (state.State[0] == TCPState.States.NEW)
                    {
                        EndOfStream(state, 0, " >200 packets");
                        state.Clear();
                    }
                }
            }

            bool moretodo = true;

            while (moretodo)
            {
                moretodo = false;
                foreach (TCPState state in List[0].Values)
                {
                    //This is based on packet time, not current time
                    TimeSpan ts  = LastParsedPacketTime - state.LastAddedTime;
                    string   err = "";

                    if (type == CleanupType.TERMINAL)
                    {
                        err = "Forced Close";
                    }
                    else if (ts.TotalSeconds > 20 && state.State[0] != TCPState.States.RUNNING)
                    {
                        err = " > 20 seconds and not running : State was " + state.State.ToString();
                    }
//					else if( ts.TotalSeconds > 300)  // &&&& 300
//						err = " > 300 seconds since last activity";

                    if (err != "")
                    {
                        List[0].Remove(state.Signature[0]);
                        List[1].Remove(state.Signature[1]);
                        if (running && state.State[0] != TCPState.States.REPORTED)
                        //if((state.State[0] != TCPState.States.REPORTED) && (state.State[0] != TCPState.States.FINISHED))
                        {
                            EndOfStream(state, 0, err);
                        }
                        moretodo = true;
                        break;
                    }
                }
            }
        }