File tree Expand file tree Collapse file tree 1 file changed +8
-22
lines changed
Expand file tree Collapse file tree 1 file changed +8
-22
lines changed Original file line number Diff line number Diff line change 1- using System ;
2- using System . Collections . Generic ;
3- using System . IO ;
4- using System . Text . RegularExpressions ;
5- using Toxy ;
1+ using System . IO ;
62
73namespace Toxy . Parsers
84{
95 public class RTFTextParser : ITextParser
106 {
117 public RTFTextParser ( ParserContext context )
128 {
13- this . Context = context ;
14- }
15- public virtual ParserContext Context
16- {
17- get ; set ;
9+ Context = context ;
1810 }
11+ public virtual ParserContext Context { get ; set ; }
1912 public string Parse ( )
2013 {
2114 if ( ! File . Exists ( Context . Path ) )
22- throw new FileNotFoundException ( "File " + Context . Path + " is not found" ) ;
23-
24- StreamReader sr = null ;
25- try
2615 {
27- ReasonableRTF . RtfToTextConverter converter = new ReasonableRTF . RtfToTextConverter ( ) ;
28- ReasonableRTF . Models . RtfResult result = converter . Convert ( File . ReadAllBytes ( Context . Path ) ) ;
29- return result . Text ;
30- }
31- finally
32- {
33- if ( sr != null )
34- sr . Close ( ) ;
16+ throw new FileNotFoundException ( "File " + Context . Path + " is not found" ) ;
3517 }
18+
19+ ReasonableRTF . RtfToTextConverter converter = new ReasonableRTF . RtfToTextConverter ( ) ;
20+ ReasonableRTF . Models . RtfResult result = converter . Convert ( File . ReadAllBytes ( Context . Path ) ) ;
21+ return result . Text ;
3622 }
3723 }
3824}
You can’t perform that action at this time.
0 commit comments