File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11using System ;
22using System . IO ;
33using System . Reflection ;
4+ using System . Text . RegularExpressions ;
45
56namespace RadiantMapToWavefrontObj
67{
@@ -24,6 +25,8 @@ static void Main(string[] args)
2425 ConvertFile ( arg ) ;
2526 success = true ;
2627 }
28+ else
29+ HandleArgument ( arg ) ;
2730 }
2831
2932 if ( ! success )
@@ -51,5 +54,32 @@ private static void ConvertFile(string path)
5154 DateTime endTime = DateTime . Now ;
5255 Console . WriteLine ( "Finished in: " + ( endTime - startTime ) . Milliseconds + "ms." ) ;
5356 }
57+
58+ // Handle a settings argument.
59+ private static void HandleArgument ( string arg )
60+ {
61+ string pattern = @"-(\w+)=(\w+)" ;
62+ Regex regex = new Regex ( pattern , RegexOptions . IgnoreCase ) ;
63+ Match m = regex . Match ( arg ) ;
64+ if ( m . Success )
65+ {
66+ string type = m . Groups [ 1 ] . ToString ( ) ;
67+ string mode = m . Groups [ 2 ] . ToString ( ) ;
68+
69+ if ( type == "autoclose" )
70+ {
71+ if ( mode == "false" || mode == "0" )
72+ _autoclose = false ;
73+ else if ( mode == "true" || mode == "1" )
74+ _autoclose = true ;
75+ }
76+ else if ( type == "scale" )
77+ {
78+ double scale ;
79+ if ( Double . TryParse ( mode , out scale ) )
80+ _scale = scale ;
81+ }
82+ }
83+ }
5484 }
5585}
You can’t perform that action at this time.
0 commit comments