2525using System ;
2626using System . Collections . Generic ;
2727using System . Linq ;
28- using System . Text ;
29- using System . Threading . Tasks ;
30- using static Orts . Viewer3D . RollingStock . Subsystems . ETCS . DriverMachineInterface ;
3128
3229namespace Orts . Viewer3D . RollingStock . SubSystems . ETCS
3330{
@@ -132,7 +129,8 @@ void SetDatePrimitive(float timestampS, int row)
132129 int totalseconds = ( int ) timestampS ;
133130 int hour = ( totalseconds / 3600 ) % 24 ;
134131 int minute = ( totalseconds / 60 ) % 60 ;
135- DisplayedTimes [ row ] = new TextPrimitive ( new Point ( 3 , ( row + 1 ) * RowHeight - ( int ) FontHeightTimestamp ) , Color . White , ( hour < 10 ? "0" : "" ) + hour . ToString ( ) + ":" + ( minute < 10 ? "0" : "" ) + minute . ToString ( ) , FontTimestamp ) ;
132+ var text = $ "{ ( hour < 10 ? "0" : "" ) } { hour } :{ ( minute < 10 ? "0" : "" ) } { minute } ";
133+ DisplayedTimes [ row ] = new TextPrimitive ( new Point ( 3 , ( row + 1 ) * RowHeight - ( int ) FontHeightTimestamp ) , Color . White , text , FontTimestamp ) ;
136134 }
137135 void SetTextPrimitive ( string text , int row , bool isBold )
138136 {
@@ -160,7 +158,7 @@ string[] GetRowSeparated(string text, bool isBold)
160158 }
161159 void SetMessages ( )
162160 {
163- for ( int i = 0 ; i < MaxTextLines ; i ++ )
161+ foreach ( int i in Enumerable . Range ( 0 , MaxTextLines ) )
164162 {
165163 DisplayedTexts [ i ] = null ;
166164 DisplayedTimes [ i ] = null ;
@@ -173,7 +171,7 @@ void SetMessages()
173171 CurrentPage = 0 ;
174172 SetDatePrimitive ( msg . TimestampS , 0 ) ;
175173 string [ ] text = GetRowSeparated ( msg . Text , false ) ;
176- for ( int j = 0 ; j < text . Length && j < MaxTextLines ; j ++ )
174+ foreach ( int j in Enumerable . Range ( 0 , Math . Min ( text . Length , MaxTextLines ) ) )
177175 {
178176 SetTextPrimitive ( text [ j ] , j , false ) ;
179177 }
@@ -185,7 +183,7 @@ void SetMessages()
185183 {
186184 if ( ! MessageList [ 0 ] . Displayed ) CurrentPage = 0 ;
187185 int row = 0 ;
188- for ( int i = 0 ; i < MessageList . Count ; i ++ )
186+ foreach ( int i in Enumerable . Range ( 0 , MessageList . Count ) )
189187 {
190188 var msg = MessageList [ i ] ;
191189 string [ ] text = GetRowSeparated ( msg . Text , msg . FirstGroup ) ;
@@ -194,11 +192,11 @@ void SetMessages()
194192 msg . Displayed = true ;
195193 SetDatePrimitive ( msg . TimestampS , row % MaxTextLines ) ;
196194 }
197- for ( int j = 0 ; j < text . Length ; j ++ )
195+ foreach ( string c in text )
198196 {
199197 if ( CurrentPage * MaxTextLines <= row && row < ( CurrentPage + 1 ) * MaxTextLines )
200198 {
201- SetTextPrimitive ( text [ j ] , row % MaxTextLines , msg . FirstGroup ) ;
199+ SetTextPrimitive ( c , row % MaxTextLines , msg . FirstGroup ) ;
202200 }
203201 row ++ ;
204202 }
0 commit comments