public static void SaveStream(this FileEntry self, Stream streamToSave, Action <long> onProgress = null)
 {
     AssertV2.AreNotEqual(0, streamToSave.Length, "streamToSave.Length");
     using (var fileStream = self.OpenOrCreateForWrite()) {
         fileStream.SetLength(0); // Reset the stream in case it was opened
         if (onProgress == null)
         {
             streamToSave.CopyTo(fileStream);
         }
         else
         {
             streamToSave.CopyTo(fileStream, onProgress);
         }
     }
 }
Exemple #2
0
 private static Task <Dictionary <string, Translation> > ConvertToDictionary(IEnumerable <Translation> translations)
 {
     AssertV2.AreNotEqual(0, translations.Count());
     return(Task.FromResult(translations.ToDictionary(e => e.key, e => e)));
 }