11using System . Collections . Generic ;
2+ using System . Globalization ;
23using System . Linq ;
34using System . Text . RegularExpressions ;
45using ThermoFisher . CommonCore . Data . Business ;
@@ -7,11 +8,20 @@ namespace ThermoRawFileParser.Writer
78{
89 public class ScanTrailer
910 {
10- public int Length { get => data . Count ; }
11+ public int Length
12+ {
13+ get => data . Count ;
14+ }
1115
12- public string [ ] Labels { get => data . Keys . ToArray ( ) ; }
16+ public string [ ] Labels
17+ {
18+ get => data . Keys . ToArray ( ) ;
19+ }
1320
14- public string [ ] Values { get => data . Values . ToArray ( ) ; }
21+ public string [ ] Values
22+ {
23+ get => data . Values . ToArray ( ) ;
24+ }
1525
1626 private readonly Dictionary < string , string > data ;
1727
@@ -32,7 +42,7 @@ public ScanTrailer(LogEntry trailerData)
3242 /// <param name="key">name of the element</param>
3343 public bool ? AsBool ( string key )
3444 {
35- if ( data . ContainsKey ( key ) )
45+ if ( data . ContainsKey ( key ) )
3646 {
3747 var stringValue = data [ key ] . ToLower ( ) ;
3848
@@ -59,8 +69,10 @@ public ScanTrailer(LogEntry trailerData)
5969 {
6070 if ( data . ContainsKey ( key ) )
6171 {
62- if ( double . TryParse ( data [ key ] , out var result ) ) return result ;
72+ if ( double . TryParse ( data [ key ] , NumberStyles . Any ,
73+ CultureInfo . CurrentCulture , out var result ) ) return result ;
6374 }
75+
6476 return null ;
6577 }
6678
@@ -75,6 +87,7 @@ public ScanTrailer(LogEntry trailerData)
7587 {
7688 if ( int . TryParse ( data [ key ] , out var result ) ) return result ;
7789 }
90+
7891 return null ;
7992 }
8093
@@ -89,7 +102,6 @@ public ScanTrailer(LogEntry trailerData)
89102
90103 if ( value != null && value > 0 ) return value ;
91104 else return null ;
92-
93105 }
94106
95107 /// <summary>
@@ -113,6 +125,7 @@ public string Get(string key)
113125 {
114126 return data [ key ] ;
115127 }
128+
116129 return null ;
117130 }
118131
@@ -143,4 +156,4 @@ public IEnumerable<string> MatchValues(Regex regex)
143156 return data . Where ( item => regex . IsMatch ( item . Key ) ) . Select ( item => item . Value ) ;
144157 }
145158 }
146- }
159+ }
0 commit comments