Skip to content

Commit 4dca972

Browse files
committed
PoolInfo.cs quality improvements
1 parent 046b13b commit 4dca972

File tree

1 file changed

+18
-22
lines changed
  • Source/Orts.Simulation/Simulation/Timetables

1 file changed

+18
-22
lines changed

Source/Orts.Simulation/Simulation/Timetables/PoolInfo.cs

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// COPYRIGHT 2014 by the Open Rails project.
1+
// COPYRIGHT 2014 by the Open Rails project.
22
//
33
// This file is part of Open Rails.
44
//
@@ -15,8 +15,7 @@
1515
// You should have received a copy of the GNU General Public License
1616
// along with Open Rails. If not, see <http://www.gnu.org/licenses/>.
1717

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 */
2019

2120
using System;
2221
using System.Collections.Generic;
@@ -44,7 +43,6 @@ public PoolInfo(Simulator simulatorref)
4443
simulator = simulatorref;
4544
}
4645

47-
4846
//================================================================================================//
4947
/// <summary>
5048
/// Read pool files
@@ -57,33 +55,33 @@ public Dictionary<string, TimetablePool> ProcessPools(string[] arguments, Cancel
5755
Dictionary<string, TimetablePool> pools = new Dictionary<string, TimetablePool>();
5856
List<string> filenames;
5957

60-
// get filenames to process
58+
// Get filenames to process
6159
filenames = GetFilenames(arguments[0]);
6260

63-
// get file contents as strings
61+
// Get file contents as strings
6462
Trace.Write("\n");
6563
foreach (string filePath in filenames)
6664
{
67-
// get contents as strings
65+
// Get contents as strings
6866
Trace.Write("Pool File : " + filePath + "\n");
6967
var poolInfo = new TimetableReader(filePath);
7068

71-
// read lines from input until 'Name' definition is found
69+
// Read lines from input until 'Name' definition is found
7270
int lineindex = 1;
7371
while (lineindex < poolInfo.Strings.Count)
7472
{
7573
switch (poolInfo.Strings[lineindex][0].ToLower().Trim())
7674
{
77-
// skip comment
78-
case "#comment" :
75+
// Skip comment
76+
case "#comment":
7977
lineindex++;
8078
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":
8583
TimetablePool newPool = new TimetablePool(poolInfo, ref lineindex, simulator);
86-
// store if valid pool
84+
// Store if valid pool
8785
if (!String.IsNullOrEmpty(newPool.PoolName))
8886
{
8987
if (pools.ContainsKey(newPool.PoolName))
@@ -95,9 +93,8 @@ public Dictionary<string, TimetablePool> ProcessPools(string[] arguments, Cancel
9593
pools.Add(newPool.PoolName, newPool);
9694
}
9795
}
98-
break;
99-
100-
default :
96+
break
97+
default:
10198
if (!String.IsNullOrEmpty(poolInfo.Strings[lineindex][0]))
10299
{
103100
Trace.TraceInformation("Invalid definition in file " + filePath + " at line " + lineindex + " : " +
@@ -109,7 +106,7 @@ public Dictionary<string, TimetablePool> ProcessPools(string[] arguments, Cancel
109106
}
110107
}
111108

112-
return (pools);
109+
return pools;
113110
}
114111

115112
//================================================================================================//
@@ -122,7 +119,7 @@ private List<string> GetFilenames(string filePath)
122119
{
123120
List<string> filenames = new List<string>();
124121

125-
// check type of timetable file - list or single
122+
// Check type of timetable file - list or single
126123
string fileDirectory = Path.GetDirectoryName(filePath);
127124

128125
foreach (var ORPoolFile in Directory.GetFiles(fileDirectory, "*.pool_or"))
@@ -134,9 +131,8 @@ private List<string> GetFilenames(string filePath)
134131
filenames.Add(ORPoolFile);
135132
}
136133

137-
return (filenames);
134+
return filenames;
138135
}
139-
140136
}
141137
}
142138

0 commit comments

Comments
 (0)