File tree 2 files changed +6
-19
lines changed
2 files changed +6
-19
lines changed Original file line number Diff line number Diff line change @@ -27,25 +27,14 @@ public class Application
27
27
/// </summary>
28
28
public const string Version = "0.1.0" ;
29
29
30
- static Application ( )
31
- {
32
- if ( Instance != null )
33
- throw new InvalidOperationException ( "PbnApplication already exists" ) ;
34
- Instance = new Application ( ) ;
35
- }
36
30
37
- private Application ( )
31
+ public Application ( )
38
32
{
39
33
tagFactory = TagFactory . MakeDefault ( ) ;
40
34
parser = new PbnParser ( PbnParser . RecoveryMode . Strict , tagFactory ) ;
41
35
boardManipulator = new PbnBoardManipulator ( ) ;
42
36
}
43
-
44
- /// <summary>
45
- /// Singleton instance.
46
- /// </summary>
47
- public static Application Instance { get ; }
48
-
37
+
49
38
/// <summary>
50
39
/// True if the application was started with the verbose flag.
51
40
/// </summary>
@@ -75,13 +64,11 @@ public void Run(Options options)
75
64
76
65
private void HandleFile ( string filename , Options options )
77
66
{
78
- using var inputFile = new StreamReader ( filename ) ;
79
-
80
-
81
67
PbnFile file ;
82
68
83
69
try
84
70
{
71
+ using var inputFile = new StreamReader ( filename ) ;
85
72
file = parser . Parse ( inputFile ) ;
86
73
}
87
74
catch ( Exception e )
Original file line number Diff line number Diff line change @@ -11,15 +11,15 @@ private static void Main(string[] args)
11
11
Parser . Default . ParseArguments < Options > ( args )
12
12
. WithParsed ( RunOptions )
13
13
. WithNotParsed ( HandleParseError ) ;
14
-
15
-
14
+
16
15
}
17
16
18
17
private static void RunOptions ( Options opts )
19
18
{
20
19
try
21
20
{
22
- Application . Instance . Run ( opts ) ;
21
+ var app = new Application ( ) ;
22
+ app . Run ( opts ) ;
23
23
} catch ( Exception e )
24
24
{
25
25
Console . Error . WriteLine ( "Error: " + e . Message ) ;
You can’t perform that action at this time.
0 commit comments