1
- // COPYRIGHT 2014 by the Open Rails project.
1
+ // COPYRIGHT 2014 by the Open Rails project.
2
2
//
3
3
// This file is part of Open Rails.
4
4
//
15
15
// You should have received a copy of the GNU General Public License
16
16
// along with Open Rails. If not, see <http://www.gnu.org/licenses/>.
17
17
18
- // This code processes the Timetable definition and converts it into playable train information
19
- //
18
+ /* This code processes the Timetable definition and converts it into playable train information */
20
19
21
20
using System ;
22
21
using System . Collections . Generic ;
@@ -44,7 +43,6 @@ public PoolInfo(Simulator simulatorref)
44
43
simulator = simulatorref ;
45
44
}
46
45
47
-
48
46
//================================================================================================//
49
47
/// <summary>
50
48
/// Read pool files
@@ -57,33 +55,33 @@ public Dictionary<string, TimetablePool> ProcessPools(string[] arguments, Cancel
57
55
Dictionary < string , TimetablePool > pools = new Dictionary < string , TimetablePool > ( ) ;
58
56
List < string > filenames ;
59
57
60
- // get filenames to process
58
+ // Get filenames to process
61
59
filenames = GetFilenames ( arguments [ 0 ] ) ;
62
60
63
- // get file contents as strings
61
+ // Get file contents as strings
64
62
Trace . Write ( "\n " ) ;
65
63
foreach ( string filePath in filenames )
66
64
{
67
- // get contents as strings
65
+ // Get contents as strings
68
66
Trace . Write ( "Pool File : " + filePath + "\n " ) ;
69
67
var poolInfo = new TimetableReader ( filePath ) ;
70
68
71
- // read lines from input until 'Name' definition is found
69
+ // Read lines from input until 'Name' definition is found
72
70
int lineindex = 1 ;
73
71
while ( lineindex < poolInfo . Strings . Count )
74
72
{
75
73
switch ( poolInfo . Strings [ lineindex ] [ 0 ] . ToLower ( ) . Trim ( ) )
76
74
{
77
- // skip comment
78
- case "#comment" :
75
+ // Skip comment
76
+ case "#comment" :
79
77
lineindex ++ ;
80
78
break ;
81
-
82
- // process name
83
- // do not increase lineindex as that is done in called method
84
- case "#name" :
79
+
80
+ // Process name
81
+ // Do not increase lineindex as that is done in called method
82
+ case "#name" :
85
83
TimetablePool newPool = new TimetablePool ( poolInfo , ref lineindex , simulator ) ;
86
- // store if valid pool
84
+ // Store if valid pool
87
85
if ( ! String . IsNullOrEmpty ( newPool . PoolName ) )
88
86
{
89
87
if ( pools . ContainsKey ( newPool . PoolName ) )
@@ -95,9 +93,8 @@ public Dictionary<string, TimetablePool> ProcessPools(string[] arguments, Cancel
95
93
pools . Add ( newPool . PoolName , newPool ) ;
96
94
}
97
95
}
98
- break ;
99
-
100
- default :
96
+ break
97
+ default :
101
98
if ( ! String . IsNullOrEmpty ( poolInfo . Strings [ lineindex ] [ 0 ] ) )
102
99
{
103
100
Trace . TraceInformation ( "Invalid definition in file " + filePath + " at line " + lineindex + " : " +
@@ -109,7 +106,7 @@ public Dictionary<string, TimetablePool> ProcessPools(string[] arguments, Cancel
109
106
}
110
107
}
111
108
112
- return ( pools ) ;
109
+ return pools ;
113
110
}
114
111
115
112
//================================================================================================//
@@ -122,7 +119,7 @@ private List<string> GetFilenames(string filePath)
122
119
{
123
120
List < string > filenames = new List < string > ( ) ;
124
121
125
- // check type of timetable file - list or single
122
+ // Check type of timetable file - list or single
126
123
string fileDirectory = Path . GetDirectoryName ( filePath ) ;
127
124
128
125
foreach ( var ORPoolFile in Directory . GetFiles ( fileDirectory , "*.pool_or" ) )
@@ -134,9 +131,8 @@ private List<string> GetFilenames(string filePath)
134
131
filenames . Add ( ORPoolFile ) ;
135
132
}
136
133
137
- return ( filenames ) ;
134
+ return filenames ;
138
135
}
139
-
140
136
}
141
137
}
142
138
0 commit comments