@@ -339,13 +339,24 @@ private long ProcessFileSize(HttpWebResponse webResp, out string filePath)
339339 readStream . Read ( read , 0 , ( int ) webResp . ContentLength ) ;
340340
341341 string file = new string ( read , 0 , ( int ) webResp . ContentLength ) ;
342- file = file . Substring ( 5 , file . Length - 5 ) ; //Removing PATH: from the output
343342
344- System . IO . FileInfo fInfo = new System . IO . FileInfo ( file ) ;
345- if ( fInfo . Exists )
343+ if ( file . Contains ( "PATH" ) )
346344 {
347- length = fInfo . Length ;
348- filePath = file ;
345+ file = file . Substring ( 5 , file . Length - 5 ) ; //Removing PATH: from the output
346+
347+ System . IO . FileInfo fInfo = new System . IO . FileInfo ( file ) ;
348+ if ( fInfo . Exists )
349+ {
350+ length = fInfo . Length ;
351+ filePath = file ;
352+ }
353+ }
354+ else
355+ {
356+ int position = webResp . ResponseUri . PathAndQuery . IndexOf ( ".pdb" ) ;
357+ string fileName = webResp . ResponseUri . PathAndQuery . Substring ( 1 , position + 3 ) ;
358+ if ( ! FailedFiles . ContainsKey ( fileName ) )
359+ FailedFiles . Add ( fileName , " - No matching PDBs found - " + file ) ;
349360 }
350361
351362 return length ;
@@ -422,7 +433,7 @@ private void downloadFile(Int32 fileNr)
422433
423434 if ( webResp . StatusCode != HttpStatusCode . OK )
424435 {
425- FailedFiles . Add ( file . Name , webResp . StatusCode + ": " + webResp . StatusDescription ) ;
436+ FailedFiles . Add ( file . Name , " - " + webResp . StatusCode + " " + webResp . StatusDescription ) ;
426437 }
427438 }
428439 else if ( webResp . StatusCode == HttpStatusCode . OK )
@@ -443,14 +454,16 @@ private void downloadFile(Int32 fileNr)
443454 string filePath = dirPath + "\\ " +
444455 file . Name ;
445456 string srcFile = null ;
446-
457+ FileStream reader ;
447458 size = ProcessFileSize ( webResp , out srcFile ) ;
448- var reader = new FileStream ( srcFile , FileMode . Open , FileAccess . Read ) ;
449- writer = new FileStream ( filePath ,
450- System . IO . FileMode . Create ) ;
451459 m_currentFileSize = size ;
460+
452461 if ( srcFile != null )
453462 {
463+ reader = new FileStream ( srcFile , FileMode . Open , FileAccess . Read ) ;
464+ writer = new FileStream ( filePath ,
465+ System . IO . FileMode . Create ) ;
466+
454467 // DownloadFile(srcFile, filePath);
455468 fireEventFromBgw ( Event . FileDownloadStarted ) ;
456469 m_currentFileProgress = 0 ;
@@ -546,7 +559,7 @@ public static void WriteToLog(string fileName, Exception exc)
546559 using ( FileStream fs = new FileStream ( "Log.txt" , FileMode . Append ) )
547560 using ( StreamWriter sr = new StreamWriter ( fs ) )
548561 {
549- sr . WriteLine ( fileName + ": " + exc . Message ) ;
562+ sr . WriteLine ( DateTime . Now . ToString ( ) + " " + fileName + ": " + exc . Message ) ;
550563 }
551564 }
552565
@@ -555,7 +568,7 @@ public static void WriteToLog(string fileName, string text)
555568 using ( FileStream fs = new FileStream ( "Log.txt" , FileMode . Append ) )
556569 using ( StreamWriter sr = new StreamWriter ( fs ) )
557570 {
558- sr . WriteLine ( fileName + ": " + text ) ;
571+ sr . WriteLine ( DateTime . Now . ToString ( ) + " " + fileName + ": " + text ) ;
559572 }
560573 }
561574
0 commit comments