@@ -82,8 +82,9 @@ await Task.Run(() =>
8282
8383 private void SplitFileByLine ( int maxLine )
8484 {
85- var encoding = FileOperationHelper . GetEncodingType ( txbFilePath . Text ) ;
86- var str = FileOperationHelper . ReadFile ( txbFilePath . Text , encoding ) ;
85+ var filePath = txbFilePath . Text ?? "" ;
86+ var encoding = FileOperationHelper . GetEncodingType ( filePath ) ;
87+ var str = FileOperationHelper . ReadFile ( filePath , encoding ) ;
8788
8889 var splitLineChar = "\r \n " ;
8990 if ( str . IndexOf ( splitLineChar ) < 0 )
@@ -127,7 +128,8 @@ private void SplitFileByLine(int maxLine)
127128
128129 private void SplitFileBySize ( int maxSize )
129130 {
130- var encoding = FileOperationHelper . GetEncodingType ( txbFilePath . Text ) ;
131+ var filePath = txbFilePath . Text ?? "" ;
132+ var encoding = FileOperationHelper . GetEncodingType ( filePath ) ;
131133 var fileIndex = 1 ;
132134 var size = ( maxSize - 10 ) * 1024 ; // 10K的Buffer
133135
@@ -192,8 +194,9 @@ private bool ReadToNextLine(FileStream fs)
192194 private void SplitFileByLength ( int length )
193195 {
194196 length = length - 100 ; // 100个字的Buffer
195- var encoding = FileOperationHelper . GetEncodingType ( txbFilePath . Text ) ;
196- var str = FileOperationHelper . ReadFile ( txbFilePath . Text , encoding ) ;
197+ var filePath = txbFilePath . Text ?? "" ;
198+ var encoding = FileOperationHelper . GetEncodingType ( filePath ) ;
199+ var str = FileOperationHelper . ReadFile ( filePath , encoding ) ;
197200 var fileIndex = 1 ;
198201
199202 do
0 commit comments