Ejemplo n.º 1
0
 private static async Task DownloadFile(string basePath, string outPath, string id, string extension,
                                        WebClient webClient, string alias)
 {
     try
     {
         var dataArr = webClient.DownloadData($"{basePath}{id}.{extension}");
         File.WriteAllBytes(@$ "{outPath}{id}.{extension}", dataArr);
         // Console.WriteLine($"DOWNLOAD OK   : {id}");
     }
     catch (Exception)
     {
         Console.WriteLine($"DOWNLOAD ERROR: {id}");
         await WriterCsv.AppendInLogFile($"{alias.Split("-")[0]}", $"{alias},{id},notFound");
     }
 }
Ejemplo n.º 2
0
 private static async Task UploadFilesToFirebase(Stream stream, string fireBaseFolder, string fileName)
 {
     try
     {
         const string token = "token from firebase";
         var          task  = new FirebaseStorage("name.appspot.com",
                                                  new FirebaseStorageOptions
         {
             AuthTokenAsyncFactory = () => Task.FromResult(token),
             ThrowOnCancel         = true,
         })
                              .Child($"{fireBaseFolder}/{fileName}")
                              .PutAsync(stream);
         // task.Progress.ProgressChanged += (s, e) => Console.WriteLine($"Progress: {e.Percentage} %");
         await task;
         // Console.WriteLine($"OK     :{fileName}");
         // Console.WriteLine(downloadUrl);
     }
     catch (Exception)
     {
         Console.WriteLine($"ERRO   :{fileName}");
         await WriterCsv.AppendInLogFile($"monster", $"{fireBaseFolder},{fileName},notFound");
     }
 }