2323using System . IO ;
2424using System . Windows . Forms ;
2525using Orts . Common ;
26+ using System . Diagnostics ;
2627
2728namespace SimulatorTester
2829{
@@ -31,9 +32,35 @@ internal class Program
3132 static void Main ( string [ ] args )
3233 {
3334 var options = args . Where ( a => a . StartsWith ( "-" ) || a . StartsWith ( "/" ) ) . Select ( a => a . Substring ( 1 ) ) ;
34- var files = args . Where ( a => ! a . StartsWith ( "-" ) && ! a . StartsWith ( "/" ) ) ;
35+ var files = args . Where ( a => ! a . StartsWith ( "-" ) && ! a . StartsWith ( "/" ) ) . ToList ( ) ;
3536 var settings = new UserSettings ( options ) ;
3637
38+ if ( files . Count != 1 || options . Contains ( "help" , StringComparer . InvariantCultureIgnoreCase ) )
39+ {
40+ var version = FileVersionInfo . GetVersionInfo ( Application . ExecutablePath ) ;
41+ Console . WriteLine ( "{0} {1}" , version . FileDescription , VersionInfo . VersionOrBuild ) ;
42+ Console . WriteLine ( ) ;
43+ Console . WriteLine ( "Usage:" ) ;
44+ Console . WriteLine ( " {0} [options] <save-file>" , Path . GetFileNameWithoutExtension ( Application . ExecutablePath ) ) ;
45+ Console . WriteLine ( ) ;
46+ Console . WriteLine ( "Options:" ) ;
47+ Console . WriteLine ( " <save-file> {0} save file to use" , Application . ProductName ) ;
48+ Console . WriteLine ( " /quiet Do not show summary of simulation (only exit code is set)" ) ;
49+ Console . WriteLine ( " /verbose Show version and settings (similar to a {0} log)" , Application . ProductName ) ;
50+ Console . WriteLine ( " /fps <fps> Set the simulation frame-rate [default: 10]" ) ;
51+ Console . WriteLine ( " /help Show help and usage information" ) ;
52+ Console . WriteLine ( " ...and any standard {0} option" , Application . ProductName ) ;
53+ Console . WriteLine ( ) ;
54+ Console . WriteLine ( "The {0} takes a save file and:" , version . FileDescription ) ;
55+ Console . WriteLine ( " - Loads the same activity as contained in the save file" ) ;
56+ Console . WriteLine ( " - Runs the simulation at the specified FPS for the same duration as the save file" ) ;
57+ Console . WriteLine ( " - Compares the final position with that contained in the save file" ) ;
58+ Console . WriteLine ( ) ;
59+ Console . WriteLine ( "The exit code is set to the distance from the target in meters" ) ;
60+ Console . WriteLine ( ) ;
61+ return ;
62+ }
63+
3764 if ( settings . Verbose )
3865 {
3966 Console . WriteLine ( "This is a log file for {0}. Please include this file in bug reports." , Application . ProductName ) ;
@@ -53,7 +80,7 @@ static void Main(string[] args)
5380 LogSeparator ( ) ;
5481 }
5582
56- var saveFile = files . First ( ) ;
83+ var saveFile = files [ 0 ] ;
5784 using ( BinaryReader inf = new BinaryReader ( new FileStream ( saveFile , FileMode . Open , FileAccess . Read ) ) )
5885 {
5986 var cts = new CancellationTokenSource ( ( ) => { } ) ;
0 commit comments