@@ -10,6 +10,10 @@ public class MatchDecoder
1010 const char PROPERTY_SEPARATOR = '|' ;
1111 const char MATCH_SEPARATOR = ',' ;
1212
13+ public MatchDecoder ( )
14+ {
15+ }
16+
1317 public static List < Match > DecodeMatch ( string s , ArtifactClient client )
1418 {
1519 if ( string . IsNullOrEmpty ( s ) )
@@ -18,10 +22,10 @@ public static List<Match> DecodeMatch(string s, ArtifactClient client)
1822 s = RemoveFormatting ( s ) ;
1923
2024 List < Match > matches = new List < Match > ( ) ;
21- try
25+ string [ ] matchArr = s . Split ( MATCH_SEPARATOR ) ;
26+ foreach ( string match in matchArr )
2227 {
23- string [ ] matchArr = s . Split ( MATCH_SEPARATOR ) ;
24- foreach ( string match in matchArr )
28+ try
2529 {
2630 if ( string . IsNullOrEmpty ( match ) )
2731 continue ;
@@ -33,7 +37,7 @@ public static List<Match> DecodeMatch(string s, ArtifactClient client)
3337 {
3438 if ( string . IsNullOrEmpty ( properties [ i ] ) )
3539 {
36- Console . WriteLine ( $ "Empty property at value { i } ") ;
40+ Logger . OutputError ( $ "Empty property at value { i } ") ;
3741 continue ;
3842 }
3943
@@ -133,25 +137,25 @@ public static List<Match> DecodeMatch(string s, ArtifactClient client)
133137 }
134138 else
135139 {
136- throw new NotImplementedException ( "Unknown property" ) ;
140+ throw new NotImplementedException ( $ "Unknown property - ' { properties [ i ] } ' ") ;
137141 }
138142 }
139143
140- //Only add one instance of the game Id to the list.
141- //Currently an issue with duplicate games in the history (Check ReadMe.md)
144+ /// Only add one instance of the game Id to the list.
145+ /// Currently an issue with duplicate games in the history (Check ReadMe.md)
142146 if ( ! matches . Exists ( x => x . MatchId == m . MatchId ) )
143147 {
144148 matches . Add ( m ) ;
145149 }
146150 }
147-
148- return matches ;
149- }
150- catch ( Exception e )
151- {
152- Console . WriteLine ( $ "Unable to decode pasted content - '{ e . ToString ( ) } '") ;
153- return null ;
151+ catch ( Exception e )
152+ {
153+ Logger . OutputError ( $ "Unable to decode pasted content - '{ e . ToString ( ) } '") ;
154+ return null ;
155+ }
154156 }
157+
158+ return matches ;
155159 }
156160
157161 private static string RemoveFormatting ( string s )
0 commit comments