File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
docs/samples/Microsoft.ML.Samples/Dynamic/TensorFlow Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change 22using System . IO ;
33using System . Linq ;
44using System . Net ;
5+ using System . Net . Http ;
56using System . Text ;
7+ using System . Threading . Tasks ;
68using ICSharpCode . SharpZipLib . GZip ;
79using ICSharpCode . SharpZipLib . Tar ;
810using Microsoft . ML ;
@@ -113,10 +115,18 @@ class OutputScores
113115
114116 private static string Download ( string baseGitPath , string dataFile )
115117 {
118+ #if false
116119 using ( WebClient client = new WebClient ( ) )
117120 {
118121 client . DownloadFile ( new Uri ( $ "{ baseGitPath } ") , dataFile ) ;
119122 }
123+ #else
124+ var httpClient = new HttpClient ( ) ;
125+ using ( var file = File . OpenWrite ( dataFile ) )
126+ {
127+ httpClient . GetStreamAsync ( baseGitPath ) . ContinueWith ( ( Task < Stream > t ) => t . Result . CopyToAsync ( file ) ) ;
128+ }
129+ #endif
120130
121131 return dataFile ;
122132 }
You can’t perform that action at this time.
0 commit comments