Example #1
0
 private static StorageFolder GetStorageFolder(string folderName)
 {
     var desktop = new StorageFolder { FolderName = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) };
     var sf = DownloadHelper.GetFolder(desktop, "MS.Video.Downloader");
     return DownloadHelper.GetFolder(sf, folderName);
 }
Example #2
0
 public static async Task DownloadToFileAsync(YoutubeEntry entry, Uri uri, StorageFolder folder, string fileName, MSYoutubeLoading onYoutubeLoading)
 {
     if (entry.ExecutionStatus != ExecutionStatus.Normal) return;
     var storageFile = GetFile(folder, fileName);
     using (var destinationStream = storageFile.OpenStreamForWriteAsync()) {
         if (destinationStream == null) return;
         //var properties = await storageFile.GetBasicPropertiesAsync();
         var start = destinationStream.Length; // (long)properties.Size;
         destinationStream.Position = destinationStream.Length;
         await AddToFile(entry, uri, destinationStream, start, start + BlockSize - 1, onYoutubeLoading);
     }
 }
Example #3
0
 public static StorageFile GetFile(StorageFolder folder, string fileName)
 {
     return new StorageFile {StorageFolder = folder, FileName = fileName};
 }
Example #4
0
 public static bool FileExists(StorageFolder folder, string videoFile)
 {
     var file = new StorageFile {StorageFolder = folder, FileName = videoFile};
     return File.Exists(file.ToString());
 }
Example #5
0
 public static StorageFolder GetFolder(StorageFolder baseFolder, string folderName)
 {
     if (!Directory.Exists(baseFolder.ToString())) Directory.CreateDirectory(baseFolder.ToString());
     var path = baseFolder + "\\" + folderName;
     if(!Directory.Exists(path)) Directory.CreateDirectory(path);
     return new StorageFolder(path);
 }