| @@ -28,22 +28,14 @@ namespace Tensorflow.Hub | |||||
| var fileSaveTo = Path.Combine(dirSaveTo, fileName); | var fileSaveTo = Path.Combine(dirSaveTo, fileName); | ||||
| if (File.Exists(fileSaveTo)) | if (File.Exists(fileSaveTo)) | ||||
| return; | |||||
| Directory.CreateDirectory(dirSaveTo); | |||||
| using (var wc = new WebClient()) | |||||
| { | { | ||||
| //TODO:maybe you can check file's hashcode and "donglowad.info" to complete file ... | |||||
| Console.WriteLine($"{fileSaveTo} already exists."); | |||||
| await wc.DownloadFileTaskAsync(url, fileSaveTo); | |||||
| } | } | ||||
| else | |||||
| { | |||||
| if (!Directory.Exists(dirSaveTo)) | |||||
| Directory.CreateDirectory(dirSaveTo); | |||||
| using (var wc = new WebClient()) | |||||
| { | |||||
| await wc.DownloadFileTaskAsync(url, fileSaveTo); | |||||
| } | |||||
| } | |||||
| } | } | ||||
| public static async Task UnzipAsync<TDataSet>(this IModelLoader<TDataSet> modelLoader, string zipFile, string saveTo) | public static async Task UnzipAsync<TDataSet>(this IModelLoader<TDataSet> modelLoader, string zipFile, string saveTo) | ||||
| @@ -52,8 +44,7 @@ namespace Tensorflow.Hub | |||||
| if (!Path.IsPathRooted(saveTo)) | if (!Path.IsPathRooted(saveTo)) | ||||
| saveTo = Path.Combine(AppContext.BaseDirectory, saveTo); | saveTo = Path.Combine(AppContext.BaseDirectory, saveTo); | ||||
| if (!Directory.Exists(saveTo)) | |||||
| Directory.CreateDirectory(saveTo); | |||||
| Directory.CreateDirectory(saveTo); | |||||
| if (!Path.IsPathRooted(zipFile)) | if (!Path.IsPathRooted(zipFile)) | ||||
| zipFile = Path.Combine(AppContext.BaseDirectory, zipFile); | zipFile = Path.Combine(AppContext.BaseDirectory, zipFile); | ||||