@@ -10,22 +10,17 @@ public static string GetPath(string location)
1010 var callerClassName = new StackFrame ( 1 ) . GetMethod ( ) ! . DeclaringType ! . Name ;
1111 var resourceFolder = Path . Combine ( "Resources" , callerClassName ) ;
1212 var path = Path . Combine ( resourceFolder , location ) ;
13- if ( File . Exists ( path ) || Directory . Exists ( path ) )
14- {
15- return path ;
16- }
13+ if ( File . Exists ( path ) || Directory . Exists ( path ) ) return path ;
1714
18- throw new FileNotFoundException ( $ "The file or folder { location } does not exist in the resource folder for { callerClassName } .") ;
15+ throw new FileNotFoundException (
16+ $ "The file or folder { location } does not exist in the resource folder for { callerClassName } .") ;
1917 }
2018
2119 public static T [ ] ImportArrayFromJson < T > ( string jsonFile ) where T : struct
2220 {
2321 var callerClassName = new StackFrame ( 1 ) . GetMethod ( ) ! . DeclaringType ! . Name ;
2422 var filePath = Path . Combine ( "Resources" , callerClassName , jsonFile ) ;
25- if ( File . Exists ( filePath ) == false )
26- {
27- throw new FileNotFoundException ( $ "The file { filePath } does not exist.") ;
28- }
23+ if ( File . Exists ( filePath ) == false ) throw new FileNotFoundException ( $ "The file { filePath } does not exist.") ;
2924
3025 using var fs = new FileStream ( filePath , FileMode . Open ) ;
3126 return JsonSerializer . Deserialize < T [ ] > ( fs ) ?? [ ] ;
@@ -35,10 +30,7 @@ public static string ImportText(string fileName)
3530 {
3631 var callerClassName = new StackFrame ( 1 ) . GetMethod ( ) ! . DeclaringType ! . Name ;
3732 var filePath = Path . Combine ( "Resources" , callerClassName , fileName ) ;
38- if ( File . Exists ( filePath ) == false )
39- {
40- throw new FileNotFoundException ( $ "The file { filePath } does not exist.") ;
41- }
33+ if ( File . Exists ( filePath ) == false ) throw new FileNotFoundException ( $ "The file { filePath } does not exist.") ;
4234
4335 using var sr = new StreamReader ( filePath ) ;
4436 return sr . ReadToEnd ( ) ;
0 commit comments