88
99 class ProcessCleanup : ProcessHandlerBase
1010 {
11- private SettingsCleanupTriggerItem triggerdItem = null ;
12- private DateTime m_start ;
11+ private SettingsCleanupTriggerItem _triggerdItem ;
12+ private DateTime _start ;
1313
1414 public ProcessCleanup ( )
1515 {
16- m_start = DateTime . Now ;
16+ _start = DateTime . Now ;
1717 }
1818
1919 public override int GetUpdateResolution ( )
@@ -46,18 +46,19 @@ public override void Handle()
4646 }
4747 catch ( Exception ex )
4848 {
49- Logging . WriteLineAndConsole ( string . Format ( "ProcessCleanup.Handle(): {0}" , ex . ToString ( ) ) ) ;
49+ Logging . WriteLineAndConsole ( string . Format ( "ProcessCleanup.Handle(): {0}" , ex ) ) ;
5050 }
5151
5252 base . Handle ( ) ;
5353 }
5454
55+ /// <exception cref="OverflowException"></exception>
5556 private void ProcessTimedItem ( SettingsCleanupTimedItem item )
5657 {
57- DateTime time = new DateTime ( m_start . Year , m_start . Month , m_start . Day , item . Restart . Hour , item . Restart . Minute , 0 ) ;
58+ DateTime time = new DateTime ( _start . Year , _start . Month , _start . Day , item . Restart . Hour , item . Restart . Minute , 0 ) ;
5859 if ( time - DateTime . Now < TimeSpan . FromSeconds ( - 20 ) )
5960 {
60- time = new DateTime ( m_start . Year , m_start . Month , m_start . Day + 1 , item . Restart . Hour , item . Restart . Minute , 0 ) ;
61+ time = new DateTime ( _start . Year , _start . Month , _start . Day + 1 , item . Restart . Hour , item . Restart . Minute , 0 ) ;
6162 }
6263
6364 if ( DateTime . Now - item . LastRan < TimeSpan . FromMinutes ( 1 ) )
@@ -66,7 +67,7 @@ private void ProcessTimedItem(SettingsCleanupTimedItem item)
6667 if ( time - DateTime . Now < TimeSpan . FromSeconds ( 1 ) && DateTime . Now - item . LastRan > TimeSpan . FromMinutes ( 1 ) )
6768 {
6869 string command = item . ScanCommand + " quiet" ;
69- HashSet < IMyEntity > entities = CubeGrids . ScanGrids ( 0 , command . Split ( new char [ ] { ' ' } ) ) ;
70+ HashSet < IMyEntity > entities = CubeGrids . ScanGrids ( 0 , command . Split ( ' ' ) ) ;
7071 CubeGrids . DeleteGrids ( entities ) ;
7172 Communication . SendPublicInformation ( string . Format ( "[NOTICE]: Timed cleanup has run. {0} entities removed. Have a nice day." , entities . Count ) ) ;
7273 item . LastRan = DateTime . Now ;
@@ -94,24 +95,25 @@ private void ProcessTimedItem(SettingsCleanupTimedItem item)
9495 }
9596 }
9697
98+ /// <exception cref="OverflowException"></exception>
9799 private void ProcessTriggerItem ( SettingsCleanupTriggerItem item )
98100 {
99- if ( triggerdItem != null && triggerdItem != item )
101+ if ( _triggerdItem != null && _triggerdItem != item )
100102 return ;
101103
102- if ( triggerdItem == null )
104+ if ( _triggerdItem == null )
103105 {
104106 // Increase to 5 minutes
105107 if ( DateTime . Now - item . LastRan > TimeSpan . FromSeconds ( 300 ) )
106108 {
107109 item . LastRan = DateTime . Now ;
108110 string command = item . ScanCommand + " quiet" ;
109- HashSet < IMyEntity > entities = CubeGrids . ScanGrids ( 0 , command . Split ( new char [ ] { ' ' } ) ) ;
111+ HashSet < IMyEntity > entities = CubeGrids . ScanGrids ( 0 , command . Split ( ' ' ) ) ;
110112 if ( entities . Count >= item . MaxCapacity )
111113 {
112114 Communication . SendPublicInformation ( string . Format ( "[NOTICE]: Cleanup triggered. ({0} of {1}) triggered grids found. Cleanup will run in {2} minutes. Reason: {3}" , entities . Count , item . MaxCapacity , item . MinutesAfterCapacity , item . Reason ) ) ;
113115 item . NotificationItemsRan . Clear ( ) ;
114- triggerdItem = item ;
116+ _triggerdItem = item ;
115117 return ;
116118 }
117119 }
@@ -121,10 +123,10 @@ private void ProcessTriggerItem(SettingsCleanupTriggerItem item)
121123 if ( DateTime . Now - item . LastRan > TimeSpan . FromMinutes ( item . MinutesAfterCapacity ) )
122124 {
123125 string command = item . ScanCommand + " quiet" ;
124- HashSet < IMyEntity > entities = CubeGrids . ScanGrids ( 0 , command . Split ( new char [ ] { ' ' } ) ) ;
126+ HashSet < IMyEntity > entities = CubeGrids . ScanGrids ( 0 , command . Split ( ' ' ) ) ;
125127 CubeGrids . DeleteGrids ( entities ) ;
126128 Communication . SendPublicInformation ( string . Format ( "[NOTICE]: Triggered cleanup has run. {0} entities removed. Have a nice day." , entities . Count ) ) ;
127- triggerdItem = null ;
129+ _triggerdItem = null ;
128130 return ;
129131 }
130132
0 commit comments