Esempio n. 1
0
        /// <summary>
        /// Moves the downloaded file to the downloads folder of the windows user.
        /// </summary>
        /// <param name="videoInfo"></param>
        private void MoveFileToDownloadsFolder(VideoInformation videoInfo)
        {
            try
            {
                var downloadsFolder = KnownFolders.GetPath(KnownFolder.Downloads);
                if (File.Exists($"{downloadsFolder}\\{videoInfo.FileName}"))
                {
                    Console.WriteLine($"{videoInfo.FileName} already exists within your Download Folder.");
                    Console.WriteLine($"Would you like to overwrite it? (y/n)");

                    if (ApplicationNavigation.DetermineYesOrNo())
                    {
                        File.Move(videoInfo.SourceLocation, downloadsFolder, true);
                    }
                    else
                    {
                        Console.WriteLine("Would you like to restart? (y/n)");
                        if (ApplicationNavigation.DetermineYesOrNo())
                        {
                            Console.Clear();
                            ApplicationNavigation.StartApplicationProcess();
                        }
                        else
                        {
                            ApplicationNavigation.CloseApplication(10);
                        }
                    }
                }
            }
            catch (IOException ioException)
            {
                Console.WriteLine(ioException.Message);
                throw;
            }
        }
Esempio n. 2
0
 private static async Task StartProgram()
 {
     try
     {
         ApplicationNavigation.StartApplicationProcess();
         await Task.Delay(-1);
     }
     catch (Exception ex)
     {
         Console.WriteLine("Application exploded. Please locate ErrorReport.txt and send it to my developer.");
         Log.LogExceptionAsync(ex, ApplicationNavigation.VideoInfo);
         ApplicationNavigation.RestartApplication();
     }
 }
 public static void DownloadCompleteMessaging()
 {
     Console.Clear();
     Console.WriteLine("Download Complete!");
     Console.WriteLine("Would you like to download another? (y/n)");
     if (ApplicationNavigation.DetermineYesOrNo())
     {
         Console.Clear();
         ApplicationNavigation.StartApplicationProcess();
     }
     else
     {
         ApplicationNavigation.CloseApplication();
     }
 }